Move document classification from document to document version
Classification now lives exclusively on DocumentVersion. The field is removed from the Document model, all SQL queries, GraphQL Document type, SignableDocument type, UpdateDocumentInput, and MCP Document schema. New documents still accept classification in CreateDocumentInput, applied to the first version. New drafts inherit classification from the previous version. PDF generation uses the version classification. The drawer allows editing classification on draft versions via the updateDocumentVersion mutation. Classification is read-only on published versions. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -2440,7 +2440,6 @@ type Document implements Node {
|
||||
title: String!
|
||||
description: String
|
||||
documentType: DocumentType!
|
||||
classification: DocumentClassification!
|
||||
currentPublishedMajor: Int
|
||||
currentPublishedMinor: Int
|
||||
trustCenterVisibility: TrustCenterVisibility!
|
||||
@@ -2481,7 +2480,6 @@ type EmployeeDocument
|
||||
title: String!
|
||||
description: String
|
||||
documentType: DocumentType!
|
||||
classification: DocumentClassification!
|
||||
signed: Boolean @goField(forceResolver: true)
|
||||
approvalState: DocumentVersionApprovalDecisionState @goField(forceResolver: true)
|
||||
|
||||
@@ -2505,6 +2503,7 @@ type EmployeeDocumentVersion
|
||||
major: Int!
|
||||
minor: Int!
|
||||
status: DocumentVersionStatus!
|
||||
classification: DocumentClassification!
|
||||
signed: Boolean! @goField(forceResolver: true)
|
||||
approvalDecision: DocumentVersionApprovalDecision @goField(forceResolver: true)
|
||||
publishedAt: Datetime
|
||||
@@ -4482,7 +4481,6 @@ input UpdateDocumentInput {
|
||||
title: String
|
||||
content: String
|
||||
documentType: DocumentType
|
||||
classification: DocumentClassification
|
||||
trustCenterVisibility: TrustCenterVisibility
|
||||
}
|
||||
|
||||
@@ -5738,7 +5736,8 @@ input DeleteDraftDocumentVersionInput {
|
||||
|
||||
input UpdateDocumentVersionInput {
|
||||
documentVersionId: ID!
|
||||
content: String!
|
||||
content: String
|
||||
classification: DocumentClassification
|
||||
}
|
||||
|
||||
input CancelSignatureRequestInput {
|
||||
|
||||
@@ -81,7 +81,6 @@ func NewDocument(document *coredata.Document) *Document {
|
||||
ID: document.OrganizationID,
|
||||
},
|
||||
DocumentType: document.DocumentType,
|
||||
Classification: document.Classification,
|
||||
CurrentPublishedMajor: document.CurrentPublishedMajor,
|
||||
CurrentPublishedMinor: document.CurrentPublishedMinor,
|
||||
TrustCenterVisibility: document.TrustCenterVisibility,
|
||||
|
||||
@@ -42,13 +42,12 @@ type (
|
||||
}
|
||||
|
||||
EmployeeDocument struct {
|
||||
ID gid.GID
|
||||
Title string
|
||||
Description *string
|
||||
DocumentType coredata.DocumentType
|
||||
Classification coredata.DocumentClassification
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
ID gid.GID
|
||||
Title string
|
||||
Description *string
|
||||
DocumentType coredata.DocumentType
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
|
||||
FilterMode EmployeeDocumentFilterMode
|
||||
}
|
||||
@@ -69,6 +68,7 @@ type (
|
||||
Major int
|
||||
Minor int
|
||||
Status coredata.DocumentVersionStatus
|
||||
Classification coredata.DocumentClassification
|
||||
PublishedAt *time.Time
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
|
||||
@@ -1664,6 +1664,7 @@ func (r *employeeDocumentResolver) Versions(ctx context.Context, obj *types.Empl
|
||||
Major: v.Major,
|
||||
Minor: v.Minor,
|
||||
Status: v.Status,
|
||||
Classification: v.Classification,
|
||||
PublishedAt: v.PublishedAt,
|
||||
CreatedAt: v.CreatedAt,
|
||||
UpdatedAt: v.UpdatedAt,
|
||||
@@ -4669,7 +4670,6 @@ func (r *mutationResolver) UpdateDocument(ctx context.Context, input types.Updat
|
||||
probo.UpdateDocumentRequest{
|
||||
DocumentID: input.ID,
|
||||
Title: input.Title,
|
||||
Classification: input.Classification,
|
||||
DocumentType: input.DocumentType,
|
||||
TrustCenterVisibility: input.TrustCenterVisibility,
|
||||
},
|
||||
@@ -5410,8 +5410,9 @@ func (r *mutationResolver) UpdateDocumentVersion(ctx context.Context, input type
|
||||
documentVersion, err := prb.Documents.UpdateVersion(
|
||||
ctx,
|
||||
probo.UpdateDocumentVersionRequest{
|
||||
ID: input.DocumentVersionID,
|
||||
Content: input.Content,
|
||||
ID: input.DocumentVersionID,
|
||||
Content: input.Content,
|
||||
Classification: input.Classification,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
@@ -10243,13 +10244,12 @@ func (r *viewerResolver) SignableDocuments(ctx context.Context, obj *types.Viewe
|
||||
employeeDocuments := make([]*types.EmployeeDocument, len(documentsPage.Data))
|
||||
for i, doc := range documentsPage.Data {
|
||||
employeeDocuments[i] = &types.EmployeeDocument{
|
||||
ID: doc.ID,
|
||||
Title: doc.Title,
|
||||
DocumentType: doc.DocumentType,
|
||||
Classification: doc.Classification,
|
||||
CreatedAt: doc.CreatedAt,
|
||||
UpdatedAt: doc.UpdatedAt,
|
||||
FilterMode: types.EmployeeDocumentFilterModeSignature,
|
||||
ID: doc.ID,
|
||||
Title: doc.Title,
|
||||
DocumentType: doc.DocumentType,
|
||||
CreatedAt: doc.CreatedAt,
|
||||
UpdatedAt: doc.UpdatedAt,
|
||||
FilterMode: types.EmployeeDocumentFilterModeSignature,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10280,13 +10280,12 @@ func (r *viewerResolver) SignableDocument(ctx context.Context, obj *types.Viewer
|
||||
}
|
||||
|
||||
return &types.EmployeeDocument{
|
||||
ID: document.ID,
|
||||
Title: document.Title,
|
||||
DocumentType: document.DocumentType,
|
||||
Classification: document.Classification,
|
||||
CreatedAt: document.CreatedAt,
|
||||
UpdatedAt: document.UpdatedAt,
|
||||
FilterMode: types.EmployeeDocumentFilterModeSignature,
|
||||
ID: document.ID,
|
||||
Title: document.Title,
|
||||
DocumentType: document.DocumentType,
|
||||
CreatedAt: document.CreatedAt,
|
||||
UpdatedAt: document.UpdatedAt,
|
||||
FilterMode: types.EmployeeDocumentFilterModeSignature,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -10324,13 +10323,12 @@ func (r *viewerResolver) ApprovableDocuments(ctx context.Context, obj *types.Vie
|
||||
employeeDocuments := make([]*types.EmployeeDocument, len(documentsPage.Data))
|
||||
for i, doc := range documentsPage.Data {
|
||||
employeeDocuments[i] = &types.EmployeeDocument{
|
||||
ID: doc.ID,
|
||||
Title: doc.Title,
|
||||
DocumentType: doc.DocumentType,
|
||||
Classification: doc.Classification,
|
||||
CreatedAt: doc.CreatedAt,
|
||||
UpdatedAt: doc.UpdatedAt,
|
||||
FilterMode: types.EmployeeDocumentFilterModeApproval,
|
||||
ID: doc.ID,
|
||||
Title: doc.Title,
|
||||
DocumentType: doc.DocumentType,
|
||||
CreatedAt: doc.CreatedAt,
|
||||
UpdatedAt: doc.UpdatedAt,
|
||||
FilterMode: types.EmployeeDocumentFilterModeApproval,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10361,13 +10359,12 @@ func (r *viewerResolver) ApprovableDocument(ctx context.Context, obj *types.View
|
||||
}
|
||||
|
||||
return &types.EmployeeDocument{
|
||||
ID: document.ID,
|
||||
Title: document.Title,
|
||||
DocumentType: document.DocumentType,
|
||||
Classification: document.Classification,
|
||||
CreatedAt: document.CreatedAt,
|
||||
UpdatedAt: document.UpdatedAt,
|
||||
FilterMode: types.EmployeeDocumentFilterModeApproval,
|
||||
ID: document.ID,
|
||||
Title: document.Title,
|
||||
DocumentType: document.DocumentType,
|
||||
CreatedAt: document.CreatedAt,
|
||||
UpdatedAt: document.UpdatedAt,
|
||||
FilterMode: types.EmployeeDocumentFilterModeApproval,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user