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

@@ -44,11 +44,11 @@ const linkedDocumentFragment = graphql`
fragment LinkedDocumentsCardFragment on Document {
id
title
documentType
versions(first: 1) {
edges {
node {
id
documentType
status
}
}
@@ -221,7 +221,7 @@ function DocumentRow(props: {
</div>
</Td>
<Td>
<DocumentTypeBadge type={document.documentType} />
<DocumentTypeBadge type={document.versions.edges[0].node.documentType} />
</Td>
<Td>
<DocumentVersionBadge state={document.versions.edges[0].node.status} />

View File

@@ -72,7 +72,13 @@ const documentsFragment = graphql`
node {
id
title
documentType
versions(first: 1, orderBy: { field: CREATED_AT, direction: DESC }) {
edges {
node {
documentType
}
}
}
}
}
}
@@ -187,7 +193,7 @@ function DocumentRow(props: RowProps) {
onClick={() => onClick(props.document.id)}
>
{props.document.title}
<DocumentTypeBadge type={props.document.documentType} />
<DocumentTypeBadge type={props.document.versions.edges[0].node.documentType} />
<Button
disabled={props.disabled}
className="ml-auto"