Remove obsolete minor publish error
Signed-off-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
committed by
Bryan Frimin
parent
b721179974
commit
600aa6b8a8
@@ -75,9 +75,6 @@ type (
|
|||||||
ErrDocumentArchived struct {
|
ErrDocumentArchived struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrCannotPublishMinorWithoutMajor struct {
|
|
||||||
}
|
|
||||||
|
|
||||||
ErrDocumentDraftNotDeletable struct {
|
ErrDocumentDraftNotDeletable struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,10 +249,6 @@ func (e ErrDocumentArchived) Error() string {
|
|||||||
return "cannot modify an archived document"
|
return "cannot modify an archived document"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e ErrCannotPublishMinorWithoutMajor) Error() string {
|
|
||||||
return "cannot publish a minor version before a major version exists"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (e ErrDocumentDraftNotDeletable) Error() string {
|
func (e ErrDocumentDraftNotDeletable) Error() string {
|
||||||
return "latest version is not a deletable draft"
|
return "latest version is not a deletable draft"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3028,10 +3028,9 @@ func formatRiskTreatment(t coredata.RiskTreatment) string {
|
|||||||
// version. The version's Major, Minor, Status and PublishedAt fields are
|
// version. The version's Major, Minor, Status and PublishedAt fields are
|
||||||
// computed here based on the document's current published state, the minor
|
// computed here based on the document's current published state, the minor
|
||||||
// flag, and whether approvers were provided. When minor is true the version
|
// flag, and whether approvers were provided. When minor is true the version
|
||||||
// is always published at currentMajor.(currentMinor+1) and approvers are
|
// is always published as a minor version and approvers are ignored. When
|
||||||
// ignored. When minor is false a non-empty approverIDs triggers an approval
|
// minor is false a non-empty approverIDs triggers an approval request at
|
||||||
// request at (currentMajor+1).0; otherwise the version is published at
|
// (currentMajor+1).0; otherwise the version is published at (currentMajor+1).0.
|
||||||
// (currentMajor+1).0.
|
|
||||||
func (s *GeneratedDocumentService) publishOrRequestApproval(
|
func (s *GeneratedDocumentService) publishOrRequestApproval(
|
||||||
ctx context.Context, scope coredata.Scoper,
|
ctx context.Context, scope coredata.Scoper,
|
||||||
tx pg.Tx,
|
tx pg.Tx,
|
||||||
@@ -3057,12 +3056,14 @@ func (s *GeneratedDocumentService) publishOrRequestApproval(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if minor {
|
if minor {
|
||||||
if document.CurrentPublishedMajor == nil || document.CurrentPublishedMinor == nil {
|
if document.CurrentPublishedMajor != nil && document.CurrentPublishedMinor != nil {
|
||||||
return &ErrCannotPublishMinorWithoutMajor{}
|
|
||||||
}
|
|
||||||
|
|
||||||
version.Major = *document.CurrentPublishedMajor
|
version.Major = *document.CurrentPublishedMajor
|
||||||
version.Minor = *document.CurrentPublishedMinor + 1
|
version.Minor = *document.CurrentPublishedMinor + 1
|
||||||
|
} else {
|
||||||
|
version.Major = 0
|
||||||
|
version.Minor = 1
|
||||||
|
}
|
||||||
|
|
||||||
version.Status = coredata.DocumentVersionStatusPublished
|
version.Status = coredata.DocumentVersionStatusPublished
|
||||||
version.PublishedAt = &now
|
version.PublishedAt = &now
|
||||||
approverIDs = nil
|
approverIDs = nil
|
||||||
|
|||||||
@@ -409,10 +409,6 @@ func (r *mutationResolver) PublishDataList(ctx context.Context, input types.Publ
|
|||||||
return nil, gqlutils.Conflict(ctx, err)
|
return nil, gqlutils.Conflict(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errMinor, ok := errors.AsType[*probo.ErrCannotPublishMinorWithoutMajor](err); ok {
|
|
||||||
return nil, gqlutils.Invalid(ctx, errMinor)
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot publish data list", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot publish data list", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
@@ -437,10 +433,6 @@ func (r *mutationResolver) PublishAssetList(ctx context.Context, input types.Pub
|
|||||||
return nil, gqlutils.Conflict(ctx, err)
|
return nil, gqlutils.Conflict(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errMinor, ok := errors.AsType[*probo.ErrCannotPublishMinorWithoutMajor](err); ok {
|
|
||||||
return nil, gqlutils.Invalid(ctx, errMinor)
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot publish asset list", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot publish asset list", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
|
|||||||
@@ -693,10 +693,6 @@ func (r *mutationResolver) PublishFindingList(ctx context.Context, input types.P
|
|||||||
return nil, gqlutils.Conflict(ctx, err)
|
return nil, gqlutils.Conflict(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errMinor, ok := errors.AsType[*probo.ErrCannotPublishMinorWithoutMajor](err); ok {
|
|
||||||
return nil, gqlutils.Invalid(ctx, errMinor)
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot publish finding list", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot publish finding list", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
|
|||||||
@@ -785,10 +785,6 @@ func (r *mutationResolver) PublishStatementOfApplicability(ctx context.Context,
|
|||||||
return nil, gqlutils.Conflict(ctx, err)
|
return nil, gqlutils.Conflict(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errMinor, ok := errors.AsType[*probo.ErrCannotPublishMinorWithoutMajor](err); ok {
|
|
||||||
return nil, gqlutils.Invalid(ctx, errMinor)
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot publish statement of applicability", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot publish statement of applicability", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
|
|||||||
@@ -280,10 +280,6 @@ func (r *mutationResolver) PublishDataProtectionImpactAssessmentList(ctx context
|
|||||||
return nil, gqlutils.Conflict(ctx, err)
|
return nil, gqlutils.Conflict(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errMinor, ok := errors.AsType[*probo.ErrCannotPublishMinorWithoutMajor](err); ok {
|
|
||||||
return nil, gqlutils.Invalid(ctx, errMinor)
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot publish data protection impact assessment list", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot publish data protection impact assessment list", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
@@ -308,10 +304,6 @@ func (r *mutationResolver) PublishTransferImpactAssessmentList(ctx context.Conte
|
|||||||
return nil, gqlutils.Conflict(ctx, err)
|
return nil, gqlutils.Conflict(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errMinor, ok := errors.AsType[*probo.ErrCannotPublishMinorWithoutMajor](err); ok {
|
|
||||||
return nil, gqlutils.Invalid(ctx, errMinor)
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot publish transfer impact assessment list", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot publish transfer impact assessment list", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
|
|||||||
@@ -1045,10 +1045,6 @@ func (r *mutationResolver) PublishDocument(ctx context.Context, input types.Publ
|
|||||||
return nil, gqlutils.Conflict(ctx, errPending)
|
return nil, gqlutils.Conflict(ctx, errPending)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errMinor, ok := errors.AsType[*probo.ErrCannotPublishMinorWithoutMajor](err); ok {
|
|
||||||
return nil, gqlutils.Invalid(ctx, errMinor)
|
|
||||||
}
|
|
||||||
|
|
||||||
if errContractEnded, ok := errors.AsType[*probo.ErrProfileContractEnded](err); ok {
|
if errContractEnded, ok := errors.AsType[*probo.ErrProfileContractEnded](err); ok {
|
||||||
return nil, gqlutils.Conflict(ctx, errContractEnded)
|
return nil, gqlutils.Conflict(ctx, errContractEnded)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,10 +125,6 @@ func (r *mutationResolver) PublishObligationList(ctx context.Context, input type
|
|||||||
return nil, gqlutils.Conflict(ctx, err)
|
return nil, gqlutils.Conflict(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errMinor, ok := errors.AsType[*probo.ErrCannotPublishMinorWithoutMajor](err); ok {
|
|
||||||
return nil, gqlutils.Invalid(ctx, errMinor)
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot publish obligation list", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot publish obligation list", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
|
|||||||
@@ -133,10 +133,6 @@ func (r *mutationResolver) PublishProcessingActivityList(ctx context.Context, in
|
|||||||
return nil, gqlutils.Conflict(ctx, err)
|
return nil, gqlutils.Conflict(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errMinor, ok := errors.AsType[*probo.ErrCannotPublishMinorWithoutMajor](err); ok {
|
|
||||||
return nil, gqlutils.Invalid(ctx, errMinor)
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot publish processing activity list", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot publish processing activity list", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
|
|||||||
@@ -246,10 +246,6 @@ func (r *mutationResolver) PublishRiskList(ctx context.Context, input types.Publ
|
|||||||
return nil, gqlutils.Conflict(ctx, err)
|
return nil, gqlutils.Conflict(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errMinor, ok := errors.AsType[*probo.ErrCannotPublishMinorWithoutMajor](err); ok {
|
|
||||||
return nil, gqlutils.Invalid(ctx, errMinor)
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot publish risk list", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot publish risk list", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
|
|||||||
@@ -581,10 +581,6 @@ func (r *mutationResolver) PublishThirdPartyList(ctx context.Context, input type
|
|||||||
return nil, gqlutils.Conflict(ctx, err)
|
return nil, gqlutils.Conflict(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if errMinor, ok := errors.AsType[*probo.ErrCannotPublishMinorWithoutMajor](err); ok {
|
|
||||||
return nil, gqlutils.Invalid(ctx, errMinor)
|
|
||||||
}
|
|
||||||
|
|
||||||
r.logger.ErrorCtx(ctx, "cannot publish thirdParty list", log.Error(err))
|
r.logger.ErrorCtx(ctx, "cannot publish thirdParty list", log.Error(err))
|
||||||
|
|
||||||
return nil, gqlutils.Internal(ctx)
|
return nil, gqlutils.Internal(ctx)
|
||||||
|
|||||||
Reference in New Issue
Block a user