Move document type from document to document version

Follow the same pattern used for classification: document type now lives
exclusively on DocumentVersion. A migration copies existing values from
documents to their versions. The document filter uses a subquery on the
latest version. All three API surfaces (GraphQL, MCP, CLI), resolvers,
frontend, and e2e tests are updated accordingly.

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2026-03-31 19:57:52 +02:00
parent 28cf3f167a
commit 9a418a7711
29 changed files with 396 additions and 314 deletions

View File

@@ -2095,7 +2095,6 @@ func (r *Resolver) UpdateDocumentTool(ctx context.Context, req *mcp.CallToolRequ
probo.UpdateDocumentRequest{
DocumentID: input.ID,
Title: input.Title,
DocumentType: input.DocumentType,
TrustCenterVisibility: input.TrustCenterVisibility,
},
)
@@ -2201,6 +2200,7 @@ func (r *Resolver) UpdateDocumentVersionTool(ctx context.Context, req *mcp.CallT
ID: input.DocumentVersionID,
Content: content,
Classification: input.Classification,
DocumentType: input.DocumentType,
},
)
if err != nil {

View File

@@ -5207,7 +5207,6 @@ components:
- id
- organization_id
- title
- document_type
- trust_center_visibility
- status
- created_at
@@ -5222,9 +5221,6 @@ components:
title:
type: string
description: Document title
document_type:
$ref: "#/components/schemas/DocumentType"
description: Document type
current_published_major:
type:
- integer
@@ -5266,6 +5262,7 @@ components:
- major
- minor
- classification
- document_type
- content
- changelog
- status
@@ -5293,6 +5290,9 @@ components:
classification:
$ref: "#/components/schemas/DocumentClassification"
description: Document classification
document_type:
$ref: "#/components/schemas/DocumentType"
description: Document type
content:
type: string
description: Document content
@@ -5482,9 +5482,6 @@ components:
title:
type: string
description: Document title
document_type:
$ref: "#/components/schemas/DocumentType"
description: Document type
trust_center_visibility:
$ref: "#/components/schemas/TrustCenterVisibility"
description: Trust center visibility
@@ -5613,6 +5610,9 @@ components:
classification:
$ref: "#/components/schemas/DocumentClassification"
description: Document classification
document_type:
$ref: "#/components/schemas/DocumentType"
description: Document type
UpdateDocumentVersionOutput:
type: object

View File

@@ -24,7 +24,6 @@ func NewDocument(d *coredata.Document) *Document {
ID: d.ID,
OrganizationID: d.OrganizationID,
Title: d.Title,
DocumentType: d.DocumentType,
CurrentPublishedMajor: d.CurrentPublishedMajor,
CurrentPublishedMinor: d.CurrentPublishedMinor,
TrustCenterVisibility: d.TrustCenterVisibility,
@@ -87,6 +86,7 @@ func NewDocumentVersion(dv *coredata.DocumentVersion) *DocumentVersion {
Major: dv.Major,
Minor: dv.Minor,
Classification: dv.Classification,
DocumentType: dv.DocumentType,
Content: dv.Content,
Changelog: dv.Changelog,
Status: dv.Status,