Fix classification api error
Fix #474 Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix document classification not being passed when creating documents
|
||||
- Fix document classification changes not syncing to draft versions
|
||||
|
||||
## [0.76.0] - 2025-10-22
|
||||
|
||||
### Added
|
||||
|
||||
@@ -1168,6 +1168,20 @@ func (s *DocumentService) Update(
|
||||
return fmt.Errorf("cannot update document: %w", err)
|
||||
}
|
||||
|
||||
// Update the draft version if it exists to keep it in sync with the document
|
||||
draftVersion := &coredata.DocumentVersion{}
|
||||
err := draftVersion.LoadLatestVersion(ctx, tx, s.svc.scope, req.DocumentID)
|
||||
if err == nil && draftVersion.Status == coredata.DocumentStatusDraft {
|
||||
draftVersion.Title = document.Title
|
||||
draftVersion.OwnerID = document.OwnerID
|
||||
draftVersion.Classification = document.Classification
|
||||
draftVersion.UpdatedAt = now
|
||||
|
||||
if err := draftVersion.Update(ctx, tx, s.svc.scope); err != nil {
|
||||
return fmt.Errorf("cannot update draft version: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
)
|
||||
|
||||
@@ -2547,6 +2547,7 @@ func (r *mutationResolver) CreateDocument(ctx context.Context, input types.Creat
|
||||
Title: input.Title,
|
||||
OwnerID: input.OwnerID,
|
||||
Content: input.Content,
|
||||
Classification: input.Classification,
|
||||
TrustCenterVisibility: input.TrustCenterVisibility,
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user