Allow editing metadata of generated document versions
Title, document type, and classification on generated documents could not be changed: any version-tracked field on a GENERATED write-mode document was rejected with ErrDocumentVersionGenerated. The error now fires only when content is being changed, so manual metadata edits flow through the same draft-on-edit path as authored documents and produce a draft version that the user can review and publish. The CLI document update --document-type enum gains STATEMENT_OF_APPLICABILITY (which generated SoA documents already use), and the GraphQL resolver maps the content-edit rejection to a Conflict instead of falling through to a generic Internal error. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -864,6 +864,9 @@ func (r *mutationResolver) UpdateDocument(ctx context.Context, input types.Updat
|
||||
if errArchived, ok := errors.AsType[*probo.ErrDocumentArchived](err); ok {
|
||||
return nil, gqlutils.Conflict(ctx, errArchived)
|
||||
}
|
||||
if errGenerated, ok := errors.AsType[*probo.ErrDocumentVersionGenerated](err); ok {
|
||||
return nil, gqlutils.Conflict(ctx, errGenerated)
|
||||
}
|
||||
if validationErrors, ok := errors.AsType[validator.ValidationErrors](err); ok {
|
||||
return nil, gqlutils.InvalidValidationErrors(ctx, validationErrors)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user