Rename owner by approver

Document owner does not make sense it's more an document approver.

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-02-13 10:12:48 +01:00
committed by Sacha Al Himdani
parent 891d607602
commit 3d8c7c4dd6
32 changed files with 301 additions and 296 deletions

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<499820c9df6a66e5a4969b593e6f257c>> * @generated SignedSource<<91bce548869c16de31b1edc3445874d2>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -14,11 +14,11 @@ export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "S
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE"; export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC"; export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
export type UpdateDocumentInput = { export type UpdateDocumentInput = {
approverId?: string | null | undefined;
classification?: DocumentClassification | null | undefined; classification?: DocumentClassification | null | undefined;
content?: string | null | undefined; content?: string | null | undefined;
documentType?: DocumentType | null | undefined; documentType?: DocumentType | null | undefined;
id: string; id: string;
ownerId?: string | null | undefined;
title?: string | null | undefined; title?: string | null | undefined;
trustCenterVisibility?: TrustCenterVisibility | null | undefined; trustCenterVisibility?: TrustCenterVisibility | null | undefined;
}; };

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<922a06289e517787e87d62f788a0cbd7>> * @generated SignedSource<<4aabb7a5e515082b00152627b1f7c2f1>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -14,11 +14,11 @@ export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "S
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE"; export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC"; export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
export type CreateDocumentInput = { export type CreateDocumentInput = {
approverId: string;
classification: DocumentClassification; classification: DocumentClassification;
content: string; content: string;
documentType: DocumentType; documentType: DocumentType;
organizationId: string; organizationId: string;
ownerId: string;
title: string; title: string;
trustCenterVisibility?: TrustCenterVisibility | null | undefined; trustCenterVisibility?: TrustCenterVisibility | null | undefined;
}; };
@@ -213,7 +213,7 @@ return {
"args": null, "args": null,
"concreteType": "Profile", "concreteType": "Profile",
"kind": "LinkedField", "kind": "LinkedField",
"name": "owner", "name": "approver",
"plural": false, "plural": false,
"selections": [ "selections": [
(v3/*: any*/), (v3/*: any*/),
@@ -358,12 +358,12 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "089c02e59ef9b51883dd556df68891b9", "cacheID": "1ec326debfa93388837c2779cb693dca",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "CreateDocumentDialogMutation", "name": "CreateDocumentDialogMutation",
"operationKind": "mutation", "operationKind": "mutation",
"text": "mutation CreateDocumentDialogMutation(\n $input: CreateDocumentInput!\n) {\n createDocument(input: $input) {\n documentEdge {\n node {\n id\n ...DocumentListItemFragment\n }\n }\n }\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n owner {\n id\n fullName\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n" "text": "mutation CreateDocumentDialogMutation(\n $input: CreateDocumentInput!\n) {\n createDocument(input: $input) {\n documentEdge {\n node {\n id\n ...DocumentListItemFragment\n }\n }\n }\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n approver {\n id\n fullName\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n"
} }
}; };
})(); })();

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<334e066f78a528494ef5c68d088c002a>> * @generated SignedSource<<5cb0be6e5ab775bdf7d509d9789e9821>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -13,11 +13,11 @@ export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "S
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE"; export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC"; export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
export type UpdateDocumentInput = { export type UpdateDocumentInput = {
approverId?: string | null | undefined;
classification?: DocumentClassification | null | undefined; classification?: DocumentClassification | null | undefined;
content?: string | null | undefined; content?: string | null | undefined;
documentType?: DocumentType | null | undefined; documentType?: DocumentType | null | undefined;
id: string; id: string;
ownerId?: string | null | undefined;
title?: string | null | undefined; title?: string | null | undefined;
trustCenterVisibility?: TrustCenterVisibility | null | undefined; trustCenterVisibility?: TrustCenterVisibility | null | undefined;
}; };
@@ -27,13 +27,13 @@ export type DocumentLayoutDrawerMutation$variables = {
export type DocumentLayoutDrawerMutation$data = { export type DocumentLayoutDrawerMutation$data = {
readonly updateDocument: { readonly updateDocument: {
readonly document: { readonly document: {
readonly classification: DocumentClassification; readonly approver: {
readonly documentType: DocumentType;
readonly id: string;
readonly owner: {
readonly fullName: string; readonly fullName: string;
readonly id: string; readonly id: string;
}; };
readonly classification: DocumentClassification;
readonly documentType: DocumentType;
readonly id: string;
}; };
}; };
}; };
@@ -100,7 +100,7 @@ v2 = [
"args": null, "args": null,
"concreteType": "Profile", "concreteType": "Profile",
"kind": "LinkedField", "kind": "LinkedField",
"name": "owner", "name": "approver",
"plural": false, "plural": false,
"selections": [ "selections": [
(v1/*: any*/), (v1/*: any*/),
@@ -139,16 +139,16 @@ return {
"selections": (v2/*: any*/) "selections": (v2/*: any*/)
}, },
"params": { "params": {
"cacheID": "968dc4701234cb6c5761eeea9faff752", "cacheID": "717ce480e61acba39409ff42ee5344cb",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "DocumentLayoutDrawerMutation", "name": "DocumentLayoutDrawerMutation",
"operationKind": "mutation", "operationKind": "mutation",
"text": "mutation DocumentLayoutDrawerMutation(\n $input: UpdateDocumentInput!\n) {\n updateDocument(input: $input) {\n document {\n id\n documentType\n classification\n owner {\n id\n fullName\n }\n }\n }\n}\n" "text": "mutation DocumentLayoutDrawerMutation(\n $input: UpdateDocumentInput!\n) {\n updateDocument(input: $input) {\n document {\n id\n documentType\n classification\n approver {\n id\n fullName\n }\n }\n }\n}\n"
} }
}; };
})(); })();
(node as any).hash = "80901db65cb0c486e23b823bd2c16bc0"; (node as any).hash = "815cb617b0685f018afe95e97c910771";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<02a8fd2b19d7f7fdc180b373fa0b17c9>> * @generated SignedSource<<a1338ba7fb986ab8e4f5d1e0355a4671>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -13,12 +13,12 @@ export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "S
export type DocumentStatus = "DRAFT" | "PUBLISHED"; export type DocumentStatus = "DRAFT" | "PUBLISHED";
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type DocumentLayoutDrawer_versionFragment$data = { export type DocumentLayoutDrawer_versionFragment$data = {
readonly classification: DocumentClassification; readonly approver: {
readonly id: string;
readonly owner: {
readonly fullName: string; readonly fullName: string;
readonly id: string; readonly id: string;
}; };
readonly classification: DocumentClassification;
readonly id: string;
readonly publishedAt: string | null | undefined; readonly publishedAt: string | null | undefined;
readonly status: DocumentStatus; readonly status: DocumentStatus;
readonly updatedAt: string; readonly updatedAt: string;
@@ -57,7 +57,7 @@ return {
"args": null, "args": null,
"concreteType": "Profile", "concreteType": "Profile",
"kind": "LinkedField", "kind": "LinkedField",
"name": "owner", "name": "approver",
"plural": false, "plural": false,
"selections": [ "selections": [
(v0/*: any*/), (v0/*: any*/),
@@ -105,6 +105,6 @@ return {
}; };
})(); })();
(node as any).hash = "f5e9183b163586bab18475a19843b186"; (node as any).hash = "63b956326e98c7620715250f4e7d1129";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<de8021b4f5b3813e939cdcd787fb254c>> * @generated SignedSource<<41d49c06d7dfad15f6c1d39cd9eddc80>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -279,7 +279,7 @@ v20 = {
"args": null, "args": null,
"concreteType": "Profile", "concreteType": "Profile",
"kind": "LinkedField", "kind": "LinkedField",
"name": "owner", "name": "approver",
"plural": false, "plural": false,
"selections": [ "selections": [
(v3/*: any*/), (v3/*: any*/),
@@ -668,12 +668,12 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "d59daf2c6257e5a744e20896c646fc38", "cacheID": "3e4d94e71ac7cf5c557b5ee59e0917ed",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "DocumentLayoutQuery", "name": "DocumentLayoutQuery",
"operationKind": "query", "operationKind": "query",
"text": "query DocumentLayoutQuery(\n $documentId: ID!\n $versionId: ID!\n $versionSpecified: Boolean!\n) {\n version: node(id: $versionId) @include(if: $versionSpecified) {\n __typename\n ... on DocumentVersion {\n id\n status\n ...DocumentActionsDropdown_versionFragment\n ...DocumentLayoutDrawer_versionFragment\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n id\n }\n document: node(id: $documentId) {\n __typename\n ... on Document {\n id\n title\n canPublish: permission(action: \"core:document-version:publish\")\n controlInfo: controls(first: 0) {\n totalCount\n }\n ...DocumentTitleFormFragment\n ...DocumentActionsDropdown_documentFragment\n ...DocumentLayoutDrawer_documentFragment\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) @skip(if: $versionSpecified) {\n edges {\n node {\n id\n status\n ...DocumentActionsDropdown_versionFragment\n ...DocumentLayoutDrawer_versionFragment\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n }\n id\n }\n}\n\nfragment DocumentActionsDropdown_documentFragment on Document {\n id\n title\n canUpdate: permission(action: \"core:document:update\")\n canDelete: permission(action: \"core:document:delete\")\n versions(first: 20) {\n totalCount\n }\n ...UpdateVersionDialogFragment\n}\n\nfragment DocumentActionsDropdown_versionFragment on DocumentVersion {\n id\n version\n status\n canDeleteDraft: permission(action: \"core:document-version:delete-draft\")\n}\n\nfragment DocumentLayoutDrawer_documentFragment on Document {\n id\n documentType\n canUpdate: permission(action: \"core:document:update\")\n}\n\nfragment DocumentLayoutDrawer_versionFragment on DocumentVersion {\n id\n classification\n owner {\n id\n fullName\n }\n version\n status\n updatedAt\n publishedAt\n}\n\nfragment DocumentTitleFormFragment on Document {\n id\n title\n canUpdate: permission(action: \"core:document:update\")\n}\n\nfragment UpdateVersionDialogFragment on Document {\n id\n versions(first: 20) {\n edges {\n node {\n id\n status\n content\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n" "text": "query DocumentLayoutQuery(\n $documentId: ID!\n $versionId: ID!\n $versionSpecified: Boolean!\n) {\n version: node(id: $versionId) @include(if: $versionSpecified) {\n __typename\n ... on DocumentVersion {\n id\n status\n ...DocumentActionsDropdown_versionFragment\n ...DocumentLayoutDrawer_versionFragment\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n id\n }\n document: node(id: $documentId) {\n __typename\n ... on Document {\n id\n title\n canPublish: permission(action: \"core:document-version:publish\")\n controlInfo: controls(first: 0) {\n totalCount\n }\n ...DocumentTitleFormFragment\n ...DocumentActionsDropdown_documentFragment\n ...DocumentLayoutDrawer_documentFragment\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) @skip(if: $versionSpecified) {\n edges {\n node {\n id\n status\n ...DocumentActionsDropdown_versionFragment\n ...DocumentLayoutDrawer_versionFragment\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n }\n id\n }\n}\n\nfragment DocumentActionsDropdown_documentFragment on Document {\n id\n title\n canUpdate: permission(action: \"core:document:update\")\n canDelete: permission(action: \"core:document:delete\")\n versions(first: 20) {\n totalCount\n }\n ...UpdateVersionDialogFragment\n}\n\nfragment DocumentActionsDropdown_versionFragment on DocumentVersion {\n id\n version\n status\n canDeleteDraft: permission(action: \"core:document-version:delete-draft\")\n}\n\nfragment DocumentLayoutDrawer_documentFragment on Document {\n id\n documentType\n canUpdate: permission(action: \"core:document:update\")\n}\n\nfragment DocumentLayoutDrawer_versionFragment on DocumentVersion {\n id\n classification\n approver {\n id\n fullName\n }\n version\n status\n updatedAt\n publishedAt\n}\n\nfragment DocumentTitleFormFragment on Document {\n id\n title\n canUpdate: permission(action: \"core:document:update\")\n}\n\nfragment UpdateVersionDialogFragment on Document {\n id\n versions(first: 20) {\n edges {\n node {\n id\n status\n content\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
} }
}; };
})(); })();

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<7dc6855a815d76f559d0efe4a8b34c66>> * @generated SignedSource<<ac954cbaf8e5e859cbf2112ce60b3047>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -14,6 +14,10 @@ export type DocumentStatus = "DRAFT" | "PUBLISHED";
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE"; export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type DocumentListItemFragment$data = { export type DocumentListItemFragment$data = {
readonly approver: {
readonly fullName: string;
readonly id: string;
};
readonly canDelete: boolean; readonly canDelete: boolean;
readonly classification: DocumentClassification; readonly classification: DocumentClassification;
readonly documentType: DocumentType; readonly documentType: DocumentType;
@@ -33,10 +37,6 @@ export type DocumentListItemFragment$data = {
}; };
}>; }>;
}; };
readonly owner: {
readonly fullName: string;
readonly id: string;
};
readonly title: string; readonly title: string;
readonly updatedAt: string; readonly updatedAt: string;
readonly " $fragmentType": "DocumentListItemFragment"; readonly " $fragmentType": "DocumentListItemFragment";
@@ -121,7 +121,7 @@ return {
"args": null, "args": null,
"concreteType": "Profile", "concreteType": "Profile",
"kind": "LinkedField", "kind": "LinkedField",
"name": "owner", "name": "approver",
"plural": false, "plural": false,
"selections": [ "selections": [
(v0/*: any*/), (v0/*: any*/),
@@ -244,6 +244,6 @@ return {
}; };
})(); })();
(node as any).hash = "6e72b37fa90b7a272ebba38fe80b9f93"; (node as any).hash = "18456198eadac7ae24bbeebf0f75b5c9";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<4cf4c96941ac10dd2b17b67c89a1dfe2>> * @generated SignedSource<<7ed1236265330f981095a621f4462123>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -14,11 +14,11 @@ export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "S
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE"; export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC"; export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
export type UpdateDocumentInput = { export type UpdateDocumentInput = {
approverId?: string | null | undefined;
classification?: DocumentClassification | null | undefined; classification?: DocumentClassification | null | undefined;
content?: string | null | undefined; content?: string | null | undefined;
documentType?: DocumentType | null | undefined; documentType?: DocumentType | null | undefined;
id: string; id: string;
ownerId?: string | null | undefined;
title?: string | null | undefined; title?: string | null | undefined;
trustCenterVisibility?: TrustCenterVisibility | null | undefined; trustCenterVisibility?: TrustCenterVisibility | null | undefined;
}; };

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<65c0e47a4a410a9ec6f917ec991f8ae9>> * @generated SignedSource<<bbb5bdb7a678a554aeb043bc7e2941f0>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -301,7 +301,7 @@ return {
"args": null, "args": null,
"concreteType": "Profile", "concreteType": "Profile",
"kind": "LinkedField", "kind": "LinkedField",
"name": "owner", "name": "approver",
"plural": false, "plural": false,
"selections": [ "selections": [
(v12/*: any*/), (v12/*: any*/),
@@ -507,12 +507,12 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "d79ffc90943fa44e309a27784a8c65b8", "cacheID": "0e6f334d4bea09ecf47fe18b87ef3b84",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "DocumentsListQuery", "name": "DocumentsListQuery",
"operationKind": "query", "operationKind": "query",
"text": "query DocumentsListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 50\n $last: Int = null\n $order: DocumentOrder = {field: TITLE, direction: ASC}\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...DocumentListFragment_16fISc\n id\n }\n}\n\nfragment DocumentListFragment_16fISc on Organization {\n documents(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n canUpdate: permission(action: \"core:document:update\")\n canDelete: permission(action: \"core:document:delete\")\n canRequestSignatures: permission(action: \"core:document-version:request-signature\")\n ...DocumentListItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n owner {\n id\n fullName\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n" "text": "query DocumentsListQuery(\n $after: CursorKey = null\n $before: CursorKey = null\n $first: Int = 50\n $last: Int = null\n $order: DocumentOrder = {field: TITLE, direction: ASC}\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...DocumentListFragment_16fISc\n id\n }\n}\n\nfragment DocumentListFragment_16fISc on Organization {\n documents(first: $first, after: $after, last: $last, before: $before, orderBy: $order) {\n edges {\n node {\n id\n canUpdate: permission(action: \"core:document:update\")\n canDelete: permission(action: \"core:document:delete\")\n canRequestSignatures: permission(action: \"core:document-version:request-signature\")\n ...DocumentListItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n approver {\n id\n fullName\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n"
} }
}; };
})(); })();

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<dbed368b10910bc2b0b62eb50f9f7e36>> * @generated SignedSource<<dcfc5a0f97ee1ee02c8679797141e265>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -316,7 +316,7 @@ return {
"args": null, "args": null,
"concreteType": "Profile", "concreteType": "Profile",
"kind": "LinkedField", "kind": "LinkedField",
"name": "owner", "name": "approver",
"plural": false, "plural": false,
"selections": [ "selections": [
(v8/*: any*/), (v8/*: any*/),
@@ -523,12 +523,12 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "be5d2e7f4a87fba4bf56e605bd849d7d", "cacheID": "5d465e00a354c06dc571df056624dd39",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "DocumentsPageQuery", "name": "DocumentsPageQuery",
"operationKind": "query", "operationKind": "query",
"text": "query DocumentsPageQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n canCreateDocument: permission(action: \"core:document:create\")\n ...DocumentListFragment_1WMmEg\n documents(first: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n canSendSigningNotifications: permission(action: \"core:document:send-signing-notifications\")\n id\n }\n }\n }\n }\n id\n }\n}\n\nfragment DocumentListFragment_1WMmEg on Organization {\n documents(first: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n id\n canUpdate: permission(action: \"core:document:update\")\n canDelete: permission(action: \"core:document:delete\")\n canRequestSignatures: permission(action: \"core:document-version:request-signature\")\n ...DocumentListItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n owner {\n id\n fullName\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n" "text": "query DocumentsPageQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n canCreateDocument: permission(action: \"core:document:create\")\n ...DocumentListFragment_1WMmEg\n documents(first: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n canSendSigningNotifications: permission(action: \"core:document:send-signing-notifications\")\n id\n }\n }\n }\n }\n id\n }\n}\n\nfragment DocumentListFragment_1WMmEg on Organization {\n documents(first: 50, orderBy: {field: TITLE, direction: ASC}) {\n edges {\n node {\n id\n canUpdate: permission(action: \"core:document:update\")\n canDelete: permission(action: \"core:document:delete\")\n canRequestSignatures: permission(action: \"core:document-version:request-signature\")\n ...DocumentListItemFragment\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n id\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n approver {\n id\n fullName\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n"
} }
}; };
})(); })();

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<d4d20efd4d936984e9a38123528ae7af>> * @generated SignedSource<<ca358b419eca687c5ba8119e7de24829>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -195,7 +195,7 @@ return {
"args": null, "args": null,
"concreteType": "Profile", "concreteType": "Profile",
"kind": "LinkedField", "kind": "LinkedField",
"name": "owner", "name": "approver",
"plural": false, "plural": false,
"selections": [ "selections": [
(v2/*: any*/), (v2/*: any*/),
@@ -324,12 +324,12 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "0ac164af501f3f1bb74483e15b320715", "cacheID": "0672eb52643ef05e90565df777644a7b",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "PublishDocumentsDialogMutation", "name": "PublishDocumentsDialogMutation",
"operationKind": "mutation", "operationKind": "mutation",
"text": "mutation PublishDocumentsDialogMutation(\n $input: BulkPublishDocumentVersionsInput!\n) {\n bulkPublishDocumentVersions(input: $input) {\n documentEdges {\n node {\n id\n ...DocumentListItemFragment\n }\n }\n }\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n owner {\n id\n fullName\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n" "text": "mutation PublishDocumentsDialogMutation(\n $input: BulkPublishDocumentVersionsInput!\n) {\n bulkPublishDocumentVersions(input: $input) {\n documentEdges {\n node {\n id\n ...DocumentListItemFragment\n }\n }\n }\n}\n\nfragment DocumentListItemFragment on Document {\n id\n title\n documentType\n classification\n updatedAt\n canDelete: permission(action: \"core:document:delete\")\n approver {\n id\n fullName\n }\n lastVersion: versions(first: 1, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n version\n signatures(first: 0, filter: {activeContract: true}) {\n totalCount\n }\n signedSignatures: signatures(first: 0, filter: {states: [SIGNED], activeContract: true}) {\n totalCount\n }\n }\n }\n }\n}\n"
} }
}; };
})(); })();

View File

@@ -5,7 +5,7 @@ import { useFormWithSchema } from "../useFormWithSchema";
export const documentSchema = z.object({ export const documentSchema = z.object({
title: z.string().min(1, "Title is required"), title: z.string().min(1, "Title is required"),
content: z.string().min(1, "Content is required"), content: z.string().min(1, "Content is required"),
ownerId: z.string().min(1, "Owner is required"), approverId: z.string().min(1, "Approver is required"),
documentType: z.enum(["OTHER", "ISMS", "POLICY", "PROCEDURE"]), documentType: z.enum(["OTHER", "ISMS", "POLICY", "PROCEDURE"]),
classification: z.enum(["PUBLIC", "INTERNAL", "CONFIDENTIAL", "SECRET"]), classification: z.enum(["PUBLIC", "INTERNAL", "CONFIDENTIAL", "SECRET"]),
}); });

View File

@@ -143,12 +143,12 @@ export function CreateDocumentDialog({ trigger, connection }: Props) {
</PropertyRow> </PropertyRow>
<PropertyRow <PropertyRow
id="ownerId" id="approverId"
label={__("Owner")} label={__("Approver")}
error={errors.ownerId?.message} error={errors.approverId?.message}
> >
<PeopleSelectField <PeopleSelectField
name="ownerId" name="approverId"
control={control} control={control}
organizationId={organizationId} organizationId={organizationId}
/> />

View File

@@ -29,7 +29,7 @@ const versionFragment = graphql`
fragment DocumentLayoutDrawer_versionFragment on DocumentVersion { fragment DocumentLayoutDrawer_versionFragment on DocumentVersion {
id id
classification classification
owner { approver {
id id
fullName fullName
} }
@@ -47,7 +47,7 @@ const updateDocumentMutation = graphql`
id id
documentType documentType
classification classification
owner { approver {
id id
fullName fullName
} }
@@ -57,7 +57,7 @@ const updateDocumentMutation = graphql`
`; `;
const schema = z.object({ const schema = z.object({
ownerId: z.string().min(1, "Owner is required"), approverId: z.string().min(1, "Approver is required"),
documentType: z.enum(documentTypes), documentType: z.enum(documentTypes),
classification: z.enum(documentClassifications), classification: z.enum(documentClassifications),
}); });
@@ -71,7 +71,7 @@ export function DocumentLayoutDrawer(props: {
const organizationId = useOrganizationId(); const organizationId = useOrganizationId();
const { __ } = useTranslate(); const { __ } = useTranslate();
const [isEditingOwner, setIsEditingOwner] = useState(false); const [isEditingApprover, setIsEditingApprover] = useState(false);
const [isEditingType, setIsEditingType] = useState(false); const [isEditingType, setIsEditingType] = useState(false);
const [isEditingClassification, setIsEditingClassification] = useState(false); const [isEditingClassification, setIsEditingClassification] = useState(false);
@@ -84,7 +84,7 @@ export function DocumentLayoutDrawer(props: {
schema, schema,
{ {
defaultValues: { defaultValues: {
ownerId: version.owner.id, approverId: version.approver.id,
documentType: document.documentType, documentType: document.documentType,
classification: version.classification, classification: version.classification,
}, },
@@ -100,16 +100,16 @@ export function DocumentLayoutDrawer(props: {
}, },
); );
const handleUpdateOwner = async (data: { ownerId: string }) => { const handleUpdateApprover = async (data: { approverId: string }) => {
await updateDocument({ await updateDocument({
variables: { variables: {
input: { input: {
id: document.id, id: document.id,
ownerId: data.ownerId, approverId: data.approverId,
}, },
}, },
onSuccess: () => { onSuccess: () => {
setIsEditingOwner(false); setIsEditingApprover(false);
}, },
}); });
}; };
@@ -151,19 +151,19 @@ export function DocumentLayoutDrawer(props: {
<div className="text-base text-txt-primary font-medium mb-4"> <div className="text-base text-txt-primary font-medium mb-4">
{__("Properties")} {__("Properties")}
</div> </div>
<PropertyRow label={__("Owner")}> <PropertyRow label={__("Approver")}>
{isEditingOwner {isEditingApprover
? ( ? (
<EditablePropertyContent <EditablePropertyContent
onSave={() => void handleSubmit(handleUpdateOwner)()} onSave={() => void handleSubmit(handleUpdateApprover)()}
onCancel={() => { onCancel={() => {
setIsEditingOwner(false); setIsEditingApprover(false);
reset(); reset();
}} }}
disabled={isUpdatingDocument} disabled={isUpdatingDocument}
> >
<PeopleSelectField <PeopleSelectField
name="ownerId" name="approverId"
control={control} control={control}
organizationId={organizationId} organizationId={organizationId}
/> />
@@ -171,12 +171,12 @@ export function DocumentLayoutDrawer(props: {
) )
: ( : (
<ReadOnlyPropertyContent <ReadOnlyPropertyContent
onEdit={() => setIsEditingOwner(true)} onEdit={() => setIsEditingApprover(true)}
canEdit={document.canUpdate} canEdit={document.canUpdate}
> >
<Badge variant="highlight" size="md" className="gap-2"> <Badge variant="highlight" size="md" className="gap-2">
<Avatar name={version.owner.fullName} /> <Avatar name={version.approver.fullName} />
{version.owner.fullName} {version.approver.fullName}
</Badge> </Badge>
</ReadOnlyPropertyContent> </ReadOnlyPropertyContent>
)} )}

View File

@@ -167,7 +167,7 @@ export function DocumentList(props: {
{__("Type")} {__("Type")}
</SortableTh> </SortableTh>
<Th className="w-32">{__("Classification")}</Th> <Th className="w-32">{__("Classification")}</Th>
<Th className="w-60">{__("Owner")}</Th> <Th className="w-60">{__("Approver")}</Th>
<Th className="w-60">{__("Last update")}</Th> <Th className="w-60">{__("Last update")}</Th>
<Th className="w-20">{__("Signatures")}</Th> <Th className="w-20">{__("Signatures")}</Th>
{hasAnyAction && <Th className="w-18"></Th>} {hasAnyAction && <Th className="w-18"></Th>}

View File

@@ -17,7 +17,7 @@ const fragment = graphql`
classification classification
updatedAt updatedAt
canDelete: permission(action: "core:document:delete") canDelete: permission(action: "core:document:delete")
owner { approver {
id id
fullName fullName
} }
@@ -129,8 +129,8 @@ export function DocumentListItem(props: {
</Td> </Td>
<Td className="w-60"> <Td className="w-60">
<div className="flex gap-2 items-center"> <div className="flex gap-2 items-center">
<Avatar name={document.owner?.fullName ?? ""} /> <Avatar name={document.approver?.fullName ?? ""} />
{document.owner?.fullName} {document.approver?.fullName}
</div> </div>
</Td> </Td>
<Td className="w-60">{formatDate(document.updatedAt)}</Td> <Td className="w-60">{formatDate(document.updatedAt)}</Td>

View File

@@ -29,7 +29,7 @@ import (
func TestDocument_Create(t *testing.T) { func TestDocument_Create(t *testing.T) {
t.Parallel() t.Parallel()
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
ownerProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
tests := []struct { tests := []struct {
name string name string
@@ -113,7 +113,7 @@ func TestDocument_Create(t *testing.T) {
input := map[string]any{ input := map[string]any{
"organizationId": owner.GetOrganizationID().String(), "organizationId": owner.GetOrganizationID().String(),
"ownerId": ownerProfileID.String(), "approverId": approverProfileID.String(),
} }
for k, v := range tt.input { for k, v := range tt.input {
input[k] = v input[k] = v
@@ -151,13 +151,13 @@ func TestDocument_Create(t *testing.T) {
func TestDocument_Create_Validation(t *testing.T) { func TestDocument_Create_Validation(t *testing.T) {
t.Parallel() t.Parallel()
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
ownerProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
tests := []struct { tests := []struct {
name string name string
input map[string]any input map[string]any
skipOrganization bool skipOrganization bool
skipOwner bool skipApprover bool
wantErrorContains string wantErrorContains string
}{ }{
{ {
@@ -172,15 +172,15 @@ func TestDocument_Create_Validation(t *testing.T) {
wantErrorContains: "organizationId", wantErrorContains: "organizationId",
}, },
{ {
name: "missing ownerId", name: "missing approverId",
input: map[string]any{ input: map[string]any{
"title": "Test Document", "title": "Test Document",
"content": "Test content", "content": "Test content",
"documentType": "POLICY", "documentType": "POLICY",
"classification": "INTERNAL", "classification": "INTERNAL",
}, },
skipOwner: true, skipApprover: true,
wantErrorContains: "ownerId", wantErrorContains: "approverId",
}, },
{ {
name: "title with HTML tags", name: "title with HTML tags",
@@ -292,8 +292,8 @@ func TestDocument_Create_Validation(t *testing.T) {
if !tt.skipOrganization { if !tt.skipOrganization {
input["organizationId"] = owner.GetOrganizationID().String() input["organizationId"] = owner.GetOrganizationID().String()
} }
if !tt.skipOwner { if !tt.skipApprover {
input["ownerId"] = ownerProfileID.String() input["approverId"] = approverProfileID.String()
} }
for k, v := range tt.input { for k, v := range tt.input {
input[k] = v input[k] = v
@@ -309,7 +309,7 @@ func TestDocument_Create_Validation(t *testing.T) {
func TestDocument_Update(t *testing.T) { func TestDocument_Update(t *testing.T) {
t.Parallel() t.Parallel()
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
ownerProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
tests := []struct { tests := []struct {
name string name string
@@ -321,7 +321,7 @@ func TestDocument_Update(t *testing.T) {
{ {
name: "update title", name: "update title",
setup: func() string { setup: func() string {
return factory.NewDocument(owner, ownerProfileID.String()). return factory.NewDocument(owner, approverProfileID.String()).
WithTitle("Document to Update"). WithTitle("Document to Update").
Create() Create()
}, },
@@ -337,7 +337,7 @@ func TestDocument_Update(t *testing.T) {
{ {
name: "update document type", name: "update document type",
setup: func() string { setup: func() string {
return factory.NewDocument(owner, ownerProfileID.String()). return factory.NewDocument(owner, approverProfileID.String()).
WithTitle("Type Test"). WithTitle("Type Test").
WithDocumentType("POLICY"). WithDocumentType("POLICY").
Create() Create()
@@ -393,8 +393,8 @@ func TestDocument_Update(t *testing.T) {
func TestDocument_Update_Validation(t *testing.T) { func TestDocument_Update_Validation(t *testing.T) {
t.Parallel() t.Parallel()
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
ownerProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
baseDocumentID := factory.NewDocument(owner, ownerProfileID.String()).WithTitle("Validation Test Document").Create() baseDocumentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("Validation Test Document").Create()
tests := []struct { tests := []struct {
name string name string
@@ -484,10 +484,10 @@ func TestDocument_Update_Validation(t *testing.T) {
func TestDocument_Delete(t *testing.T) { func TestDocument_Delete(t *testing.T) {
t.Parallel() t.Parallel()
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
ownerProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
t.Run("delete existing document", func(t *testing.T) { t.Run("delete existing document", func(t *testing.T) {
documentID := factory.NewDocument(owner, ownerProfileID.String()).WithTitle("Document to Delete").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("Document to Delete").Create()
query := ` query := `
mutation DeleteDocument($input: DeleteDocumentInput!) { mutation DeleteDocument($input: DeleteDocumentInput!) {
@@ -549,11 +549,11 @@ func TestDocument_Delete_Validation(t *testing.T) {
func TestDocument_List(t *testing.T) { func TestDocument_List(t *testing.T) {
t.Parallel() t.Parallel()
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
ownerProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
documentTitles := []string{"Document A", "Document B", "Document C"} documentTitles := []string{"Document A", "Document B", "Document C"}
for _, title := range documentTitles { for _, title := range documentTitles {
factory.NewDocument(owner, ownerProfileID.String()).WithTitle(title).Create() factory.NewDocument(owner, approverProfileID.String()).WithTitle(title).Create()
} }
query := ` query := `
@@ -621,7 +621,7 @@ func TestDocument_Query(t *testing.T) {
func TestDocument_Timestamps(t *testing.T) { func TestDocument_Timestamps(t *testing.T) {
t.Parallel() t.Parallel()
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
ownerProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
t.Run("createdAt and updatedAt are set on create", func(t *testing.T) { t.Run("createdAt and updatedAt are set on create", func(t *testing.T) {
beforeCreate := time.Now().Add(-time.Second) beforeCreate := time.Now().Add(-time.Second)
@@ -655,7 +655,7 @@ func TestDocument_Timestamps(t *testing.T) {
err := owner.Execute(query, map[string]any{ err := owner.Execute(query, map[string]any{
"input": map[string]any{ "input": map[string]any{
"organizationId": owner.GetOrganizationID().String(), "organizationId": owner.GetOrganizationID().String(),
"ownerId": ownerProfileID.String(), "approverId": approverProfileID.String(),
"title": "Timestamp Test Document", "title": "Timestamp Test Document",
"content": "Test content", "content": "Test content",
"documentType": "POLICY", "documentType": "POLICY",
@@ -669,7 +669,7 @@ func TestDocument_Timestamps(t *testing.T) {
}) })
t.Run("updatedAt changes on update", func(t *testing.T) { t.Run("updatedAt changes on update", func(t *testing.T) {
documentID := factory.NewDocument(owner, ownerProfileID.String()).WithTitle("Timestamp Update Test").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("Timestamp Update Test").Create()
getQuery := ` getQuery := `
query($id: ID!) { query($id: ID!) {
@@ -733,16 +733,16 @@ func TestDocument_Timestamps(t *testing.T) {
func TestDocument_SubResolvers(t *testing.T) { func TestDocument_SubResolvers(t *testing.T) {
t.Parallel() t.Parallel()
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
ownerProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
documentID := factory.NewDocument(owner, ownerProfileID.String()).WithTitle("SubResolver Test Document").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("SubResolver Test Document").Create()
t.Run("owner sub-resolver", func(t *testing.T) { t.Run("approver sub-resolver", func(t *testing.T) {
query := ` query := `
query($id: ID!) { query($id: ID!) {
node(id: $id) { node(id: $id) {
... on Document { ... on Document {
id id
owner { approver {
id id
fullName fullName
} }
@@ -754,16 +754,16 @@ func TestDocument_SubResolvers(t *testing.T) {
var result struct { var result struct {
Node struct { Node struct {
ID string `json:"id"` ID string `json:"id"`
Owner struct { Approver struct {
ID string `json:"id"` ID string `json:"id"`
FullName string `json:"fullName"` FullName string `json:"fullName"`
} `json:"owner"` } `json:"approver"`
} `json:"node"` } `json:"node"`
} }
err := owner.Execute(query, map[string]any{"id": documentID}, &result) err := owner.Execute(query, map[string]any{"id": documentID}, &result)
require.NoError(t, err) require.NoError(t, err)
assert.Equal(t, ownerProfileID.String(), result.Node.Owner.ID) assert.Equal(t, approverProfileID.String(), result.Node.Approver.ID)
}) })
t.Run("organization sub-resolver", func(t *testing.T) { t.Run("organization sub-resolver", func(t *testing.T) {
@@ -804,7 +804,7 @@ func TestDocument_RBAC(t *testing.T) {
t.Run("create", func(t *testing.T) { t.Run("create", func(t *testing.T) {
t.Run("owner can create", func(t *testing.T) { t.Run("owner can create", func(t *testing.T) {
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
_, err := owner.Do(` _, err := owner.Do(`
mutation CreateDocument($input: CreateDocumentInput!) { mutation CreateDocument($input: CreateDocumentInput!) {
@@ -815,7 +815,7 @@ func TestDocument_RBAC(t *testing.T) {
`, map[string]any{ `, map[string]any{
"input": map[string]any{ "input": map[string]any{
"organizationId": owner.GetOrganizationID().String(), "organizationId": owner.GetOrganizationID().String(),
"ownerId": profileID.String(), "approverId": approverProfileID.String(),
"title": "RBAC Test Document", "title": "RBAC Test Document",
"content": "Test content", "content": "Test content",
"documentType": "POLICY", "documentType": "POLICY",
@@ -828,7 +828,7 @@ func TestDocument_RBAC(t *testing.T) {
t.Run("admin can create", func(t *testing.T) { t.Run("admin can create", func(t *testing.T) {
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
admin := testutil.NewClientInOrg(t, testutil.RoleAdmin, owner) admin := testutil.NewClientInOrg(t, testutil.RoleAdmin, owner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
_, err := admin.Do(` _, err := admin.Do(`
mutation CreateDocument($input: CreateDocumentInput!) { mutation CreateDocument($input: CreateDocumentInput!) {
@@ -839,7 +839,7 @@ func TestDocument_RBAC(t *testing.T) {
`, map[string]any{ `, map[string]any{
"input": map[string]any{ "input": map[string]any{
"organizationId": admin.GetOrganizationID().String(), "organizationId": admin.GetOrganizationID().String(),
"ownerId": profileID.String(), "approverId": approverProfileID.String(),
"title": "RBAC Test Document", "title": "RBAC Test Document",
"content": "Test content", "content": "Test content",
"documentType": "POLICY", "documentType": "POLICY",
@@ -852,7 +852,7 @@ func TestDocument_RBAC(t *testing.T) {
t.Run("viewer cannot create", func(t *testing.T) { t.Run("viewer cannot create", func(t *testing.T) {
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
viewer := testutil.NewClientInOrg(t, testutil.RoleViewer, owner) viewer := testutil.NewClientInOrg(t, testutil.RoleViewer, owner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
_, err := viewer.Do(` _, err := viewer.Do(`
mutation CreateDocument($input: CreateDocumentInput!) { mutation CreateDocument($input: CreateDocumentInput!) {
@@ -863,7 +863,7 @@ func TestDocument_RBAC(t *testing.T) {
`, map[string]any{ `, map[string]any{
"input": map[string]any{ "input": map[string]any{
"organizationId": viewer.GetOrganizationID().String(), "organizationId": viewer.GetOrganizationID().String(),
"ownerId": profileID.String(), "approverId": approverProfileID.String(),
"title": "RBAC Test Document", "title": "RBAC Test Document",
"content": "Test content", "content": "Test content",
"documentType": "POLICY", "documentType": "POLICY",
@@ -877,8 +877,8 @@ func TestDocument_RBAC(t *testing.T) {
t.Run("update", func(t *testing.T) { t.Run("update", func(t *testing.T) {
t.Run("owner can update", func(t *testing.T) { t.Run("owner can update", func(t *testing.T) {
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
documentID := factory.NewDocument(owner, profileID.String()).WithTitle("RBAC Update Test").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("RBAC Update Test").Create()
_, err := owner.Do(` _, err := owner.Do(`
mutation UpdateDocument($input: UpdateDocumentInput!) { mutation UpdateDocument($input: UpdateDocumentInput!) {
@@ -898,8 +898,8 @@ func TestDocument_RBAC(t *testing.T) {
t.Run("admin can update", func(t *testing.T) { t.Run("admin can update", func(t *testing.T) {
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
admin := testutil.NewClientInOrg(t, testutil.RoleAdmin, owner) admin := testutil.NewClientInOrg(t, testutil.RoleAdmin, owner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
documentID := factory.NewDocument(owner, profileID.String()).WithTitle("RBAC Update Test").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("RBAC Update Test").Create()
_, err := admin.Do(` _, err := admin.Do(`
mutation UpdateDocument($input: UpdateDocumentInput!) { mutation UpdateDocument($input: UpdateDocumentInput!) {
@@ -919,8 +919,8 @@ func TestDocument_RBAC(t *testing.T) {
t.Run("viewer cannot update", func(t *testing.T) { t.Run("viewer cannot update", func(t *testing.T) {
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
viewer := testutil.NewClientInOrg(t, testutil.RoleViewer, owner) viewer := testutil.NewClientInOrg(t, testutil.RoleViewer, owner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
documentID := factory.NewDocument(owner, profileID.String()).WithTitle("RBAC Update Test").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("RBAC Update Test").Create()
_, err := viewer.Do(` _, err := viewer.Do(`
mutation UpdateDocument($input: UpdateDocumentInput!) { mutation UpdateDocument($input: UpdateDocumentInput!) {
@@ -941,8 +941,8 @@ func TestDocument_RBAC(t *testing.T) {
t.Run("delete", func(t *testing.T) { t.Run("delete", func(t *testing.T) {
t.Run("owner can delete", func(t *testing.T) { t.Run("owner can delete", func(t *testing.T) {
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
documentID := factory.NewDocument(owner, profileID.String()).WithTitle("RBAC Delete Test").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("RBAC Delete Test").Create()
_, err := owner.Do(` _, err := owner.Do(`
mutation DeleteDocument($input: DeleteDocumentInput!) { mutation DeleteDocument($input: DeleteDocumentInput!) {
@@ -959,8 +959,8 @@ func TestDocument_RBAC(t *testing.T) {
t.Run("admin can delete", func(t *testing.T) { t.Run("admin can delete", func(t *testing.T) {
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
admin := testutil.NewClientInOrg(t, testutil.RoleAdmin, owner) admin := testutil.NewClientInOrg(t, testutil.RoleAdmin, owner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
documentID := factory.NewDocument(owner, profileID.String()).WithTitle("RBAC Delete Test").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("RBAC Delete Test").Create()
_, err := admin.Do(` _, err := admin.Do(`
mutation DeleteDocument($input: DeleteDocumentInput!) { mutation DeleteDocument($input: DeleteDocumentInput!) {
@@ -977,8 +977,8 @@ func TestDocument_RBAC(t *testing.T) {
t.Run("viewer cannot delete", func(t *testing.T) { t.Run("viewer cannot delete", func(t *testing.T) {
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
viewer := testutil.NewClientInOrg(t, testutil.RoleViewer, owner) viewer := testutil.NewClientInOrg(t, testutil.RoleViewer, owner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
documentID := factory.NewDocument(owner, profileID.String()).WithTitle("RBAC Delete Test").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("RBAC Delete Test").Create()
_, err := viewer.Do(` _, err := viewer.Do(`
mutation DeleteDocument($input: DeleteDocumentInput!) { mutation DeleteDocument($input: DeleteDocumentInput!) {
@@ -996,8 +996,8 @@ func TestDocument_RBAC(t *testing.T) {
t.Run("read", func(t *testing.T) { t.Run("read", func(t *testing.T) {
t.Run("owner can read", func(t *testing.T) { t.Run("owner can read", func(t *testing.T) {
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
documentID := factory.NewDocument(owner, profileID.String()).WithTitle("RBAC Read Test").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("RBAC Read Test").Create()
var result struct { var result struct {
Node *struct { Node *struct {
@@ -1020,8 +1020,8 @@ func TestDocument_RBAC(t *testing.T) {
t.Run("admin can read", func(t *testing.T) { t.Run("admin can read", func(t *testing.T) {
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
admin := testutil.NewClientInOrg(t, testutil.RoleAdmin, owner) admin := testutil.NewClientInOrg(t, testutil.RoleAdmin, owner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
documentID := factory.NewDocument(owner, profileID.String()).WithTitle("RBAC Read Test").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("RBAC Read Test").Create()
var result struct { var result struct {
Node *struct { Node *struct {
@@ -1044,8 +1044,8 @@ func TestDocument_RBAC(t *testing.T) {
t.Run("viewer can read", func(t *testing.T) { t.Run("viewer can read", func(t *testing.T) {
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
viewer := testutil.NewClientInOrg(t, testutil.RoleViewer, owner) viewer := testutil.NewClientInOrg(t, testutil.RoleViewer, owner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
documentID := factory.NewDocument(owner, profileID.String()).WithTitle("RBAC Read Test").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("RBAC Read Test").Create()
var result struct { var result struct {
Node *struct { Node *struct {
@@ -1070,7 +1070,7 @@ func TestDocument_RBAC(t *testing.T) {
func TestDocument_MaxLength_Validation(t *testing.T) { func TestDocument_MaxLength_Validation(t *testing.T) {
t.Parallel() t.Parallel()
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
ownerProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
longTitle := strings.Repeat("a", 1001) longTitle := strings.Repeat("a", 1001)
@@ -1088,7 +1088,7 @@ func TestDocument_MaxLength_Validation(t *testing.T) {
_, err := owner.Do(query, map[string]any{ _, err := owner.Do(query, map[string]any{
"input": map[string]any{ "input": map[string]any{
"organizationId": owner.GetOrganizationID().String(), "organizationId": owner.GetOrganizationID().String(),
"ownerId": ownerProfileID.String(), "approverId": approverProfileID.String(),
"title": longTitle, "title": longTitle,
"content": "Test content", "content": "Test content",
"documentType": "POLICY", "documentType": "POLICY",
@@ -1100,7 +1100,7 @@ func TestDocument_MaxLength_Validation(t *testing.T) {
}) })
t.Run("update", func(t *testing.T) { t.Run("update", func(t *testing.T) {
documentID := factory.NewDocument(owner, ownerProfileID.String()).WithTitle("Max Length Test").Create() documentID := factory.NewDocument(owner, approverProfileID.String()).WithTitle("Max Length Test").Create()
query := ` query := `
mutation UpdateDocument($input: UpdateDocumentInput!) { mutation UpdateDocument($input: UpdateDocumentInput!) {
@@ -1124,10 +1124,10 @@ func TestDocument_MaxLength_Validation(t *testing.T) {
func TestDocument_Pagination(t *testing.T) { func TestDocument_Pagination(t *testing.T) {
t.Parallel() t.Parallel()
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
ownerProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
for i := 0; i < 5; i++ { for i := 0; i < 5; i++ {
factory.NewDocument(owner, ownerProfileID.String()). factory.NewDocument(owner, approverProfileID.String()).
WithTitle(fmt.Sprintf("Pagination Document %d", i)). WithTitle(fmt.Sprintf("Pagination Document %d", i)).
Create() Create()
} }
@@ -1273,8 +1273,8 @@ func TestDocument_TenantIsolation(t *testing.T) {
org1Owner := testutil.NewClient(t, testutil.RoleOwner) org1Owner := testutil.NewClient(t, testutil.RoleOwner)
org2Owner := testutil.NewClient(t, testutil.RoleOwner) org2Owner := testutil.NewClient(t, testutil.RoleOwner)
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, org1Owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, org1Owner).GetProfileID()
documentID := factory.NewDocument(org1Owner, profileID.String()).WithTitle("Org1 Document").Create() documentID := factory.NewDocument(org1Owner, approverProfileID.String()).WithTitle("Org1 Document").Create()
t.Run("cannot read document from another organization", func(t *testing.T) { t.Run("cannot read document from another organization", func(t *testing.T) {
query := ` query := `
@@ -1380,10 +1380,10 @@ func TestDocument_TenantIsolation(t *testing.T) {
func TestDocument_Ordering(t *testing.T) { func TestDocument_Ordering(t *testing.T) {
t.Parallel() t.Parallel()
owner := testutil.NewClient(t, testutil.RoleOwner) owner := testutil.NewClient(t, testutil.RoleOwner)
ownerProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID() approverProfileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
factory.NewDocument(owner, ownerProfileID.String()).WithTitle("AAA Order Test").Create() factory.NewDocument(owner, approverProfileID.String()).WithTitle("AAA Order Test").Create()
factory.NewDocument(owner, ownerProfileID.String()).WithTitle("ZZZ Order Test").Create() factory.NewDocument(owner, approverProfileID.String()).WithTitle("ZZZ Order Test").Create()
t.Run("order by created_at descending", func(t *testing.T) { t.Run("order by created_at descending", func(t *testing.T) {
query := ` query := `

View File

@@ -68,7 +68,7 @@ func createTestDocument(t *testing.T, owner *testutil.Client) (docID string, doc
"organizationId": owner.GetOrganizationID().String(), "organizationId": owner.GetOrganizationID().String(),
"title": "Test Document", "title": "Test Document",
"content": "Initial content", "content": "Initial content",
"ownerId": profileID.String(), "approverId": profileID.String(),
"documentType": "POLICY", "documentType": "POLICY",
"classification": "INTERNAL", "classification": "INTERNAL",
}, },

View File

@@ -764,7 +764,7 @@ func (b *MeetingBuilder) Create() string {
return CreateMeeting(b.client, b.attrs) return CreateMeeting(b.client, b.attrs)
} }
func CreateDocument(c *testutil.Client, ownerID string, attrs ...Attrs) string { func CreateDocument(c *testutil.Client, approverID string, attrs ...Attrs) string {
c.T.Helper() c.T.Helper()
var a Attrs var a Attrs
@@ -784,7 +784,7 @@ func CreateDocument(c *testutil.Client, ownerID string, attrs ...Attrs) string {
input := map[string]any{ input := map[string]any{
"organizationId": c.GetOrganizationID().String(), "organizationId": c.GetOrganizationID().String(),
"ownerId": ownerID, "approverId": approverID,
"title": a.getString("title", SafeName("Document")), "title": a.getString("title", SafeName("Document")),
"content": a.getString("content", "Document content"), "content": a.getString("content", "Document content"),
"documentType": a.getString("documentType", "POLICY"), "documentType": a.getString("documentType", "POLICY"),
@@ -809,12 +809,12 @@ func CreateDocument(c *testutil.Client, ownerID string, attrs ...Attrs) string {
type DocumentBuilder struct { type DocumentBuilder struct {
client *testutil.Client client *testutil.Client
ownerID string approverID string
attrs Attrs attrs Attrs
} }
func NewDocument(c *testutil.Client, ownerID string) *DocumentBuilder { func NewDocument(c *testutil.Client, approverID string) *DocumentBuilder {
return &DocumentBuilder{client: c, ownerID: ownerID, attrs: Attrs{}} return &DocumentBuilder{client: c, approverID: approverID, attrs: Attrs{}}
} }
func (b *DocumentBuilder) WithTitle(title string) *DocumentBuilder { func (b *DocumentBuilder) WithTitle(title string) *DocumentBuilder {
@@ -838,7 +838,7 @@ func (b *DocumentBuilder) WithClassification(classification string) *DocumentBui
} }
func (b *DocumentBuilder) Create() string { func (b *DocumentBuilder) Create() string {
return CreateDocument(b.client, b.ownerID, b.attrs) return CreateDocument(b.client, b.approverID, b.attrs)
} }
func CreateProcessingActivity(c *testutil.Client, attrs ...Attrs) string { func CreateProcessingActivity(c *testutil.Client, attrs ...Attrs) string {

View File

@@ -32,7 +32,7 @@ type (
Document struct { Document struct {
ID gid.GID `db:"id"` ID gid.GID `db:"id"`
OrganizationID gid.GID `db:"organization_id"` OrganizationID gid.GID `db:"organization_id"`
OwnerID gid.GID `db:"owner_profile_id"` ApproverID gid.GID `db:"approver_profile_id"`
Title string `db:"title"` Title string `db:"title"`
DocumentType DocumentType `db:"document_type"` DocumentType DocumentType `db:"document_type"`
Classification DocumentClassification `db:"classification"` Classification DocumentClassification `db:"classification"`
@@ -83,7 +83,7 @@ func (p *Document) LoadByID(
SELECT SELECT
id, id,
organization_id, organization_id,
owner_profile_id, approver_profile_id,
title, title,
document_type, document_type,
classification, classification,
@@ -135,7 +135,7 @@ func (p *Document) LoadByIDWithFilter(
SELECT SELECT
id, id,
organization_id, organization_id,
owner_profile_id, approver_profile_id,
title, title,
document_type, document_type,
classification, classification,
@@ -188,7 +188,7 @@ func (p *Documents) LoadByIDs(
SELECT SELECT
id, id,
organization_id, organization_id,
owner_profile_id, approver_profile_id,
title, title,
document_type, document_type,
classification, classification,
@@ -270,7 +270,7 @@ func (p *Documents) LoadByOrganizationID(
SELECT SELECT
id, id,
organization_id, organization_id,
owner_profile_id, approver_profile_id,
title, title,
document_type, document_type,
classification, classification,
@@ -321,7 +321,7 @@ func (p *Documents) LoadAllByOrganizationID(
SELECT SELECT
id, id,
organization_id, organization_id,
owner_profile_id, approver_profile_id,
title, title,
document_type, document_type,
classification, classification,
@@ -371,7 +371,7 @@ INSERT INTO
tenant_id, tenant_id,
id, id,
organization_id, organization_id,
owner_profile_id, approver_profile_id,
title, title,
document_type, document_type,
classification, classification,
@@ -384,7 +384,7 @@ VALUES (
@tenant_id, @tenant_id,
@document_id, @document_id,
@organization_id, @organization_id,
@owner_profile_id, @approver_profile_id,
@title, @title,
@document_type, @document_type,
@classification, @classification,
@@ -399,7 +399,7 @@ VALUES (
"tenant_id": scope.GetTenantID(), "tenant_id": scope.GetTenantID(),
"document_id": p.ID, "document_id": p.ID,
"organization_id": p.OrganizationID, "organization_id": p.OrganizationID,
"owner_profile_id": p.OwnerID, "approver_profile_id": p.ApproverID,
"title": p.Title, "title": p.Title,
"document_type": p.DocumentType, "document_type": p.DocumentType,
"classification": p.Classification, "classification": p.Classification,
@@ -460,7 +460,7 @@ UPDATE
SET SET
title = @title, title = @title,
current_published_version = @current_published_version, current_published_version = @current_published_version,
owner_profile_id = @owner_profile_id, approver_profile_id = @approver_profile_id,
document_type = @document_type, document_type = @document_type,
classification = @classification, classification = @classification,
trust_center_visibility = @trust_center_visibility, trust_center_visibility = @trust_center_visibility,
@@ -477,7 +477,7 @@ WHERE
"updated_at": time.Now(), "updated_at": time.Now(),
"title": p.Title, "title": p.Title,
"current_published_version": p.CurrentPublishedVersion, "current_published_version": p.CurrentPublishedVersion,
"owner_profile_id": p.OwnerID, "approver_profile_id": p.ApproverID,
"document_type": p.DocumentType, "document_type": p.DocumentType,
"classification": p.Classification, "classification": p.Classification,
"trust_center_visibility": p.TrustCenterVisibility, "trust_center_visibility": p.TrustCenterVisibility,
@@ -548,7 +548,7 @@ WITH scoped_documents AS (
SELECT SELECT
scoped_documents.id, scoped_documents.id,
scoped_documents.organization_id, scoped_documents.organization_id,
scoped_documents.owner_profile_id, scoped_documents.approver_profile_id,
scoped_documents.title, scoped_documents.title,
scoped_documents.document_type, scoped_documents.document_type,
scoped_documents.classification, scoped_documents.classification,
@@ -638,7 +638,7 @@ WITH scoped_documents AS (
SELECT SELECT
scoped_documents.id, scoped_documents.id,
scoped_documents.organization_id, scoped_documents.organization_id,
scoped_documents.owner_profile_id, scoped_documents.approver_profile_id,
scoped_documents.title, scoped_documents.title,
scoped_documents.document_type, scoped_documents.document_type,
scoped_documents.classification, scoped_documents.classification,

View File

@@ -34,7 +34,7 @@ type (
OrganizationID gid.GID `db:"organization_id"` OrganizationID gid.GID `db:"organization_id"`
DocumentID gid.GID `db:"document_id"` DocumentID gid.GID `db:"document_id"`
Title string `db:"title"` Title string `db:"title"`
OwnerID gid.GID `db:"owner_profile_id"` ApproverID gid.GID `db:"approver_profile_id"`
VersionNumber int `db:"version_number"` VersionNumber int `db:"version_number"`
Classification DocumentClassification `db:"classification"` Classification DocumentClassification `db:"classification"`
Content string `db:"content"` Content string `db:"content"`
@@ -77,7 +77,7 @@ SELECT
organization_id, organization_id,
document_id, document_id,
title, title,
owner_profile_id, approver_profile_id,
version_number, version_number,
classification, classification,
content, content,
@@ -139,7 +139,7 @@ SELECT
organization_id, organization_id,
document_id, document_id,
title, title,
owner_profile_id, approver_profile_id,
version_number, version_number,
classification, classification,
content, content,
@@ -190,7 +190,7 @@ INSERT INTO document_versions (
organization_id, organization_id,
document_id, document_id,
title, title,
owner_profile_id, approver_profile_id,
version_number, version_number,
classification, classification,
content, content,
@@ -205,7 +205,7 @@ VALUES (
@organization_id, @organization_id,
@document_id, @document_id,
@title, @title,
@owner_profile_id, @approver_profile_id,
@version_number, @version_number,
@classification, @classification,
@content, @content,
@@ -221,7 +221,7 @@ VALUES (
"organization_id": dv.OrganizationID, "organization_id": dv.OrganizationID,
"document_id": dv.DocumentID, "document_id": dv.DocumentID,
"title": dv.Title, "title": dv.Title,
"owner_profile_id": dv.OwnerID, "approver_profile_id": dv.ApproverID,
"version_number": dv.VersionNumber, "version_number": dv.VersionNumber,
"classification": dv.Classification, "classification": dv.Classification,
"content": dv.Content, "content": dv.Content,
@@ -260,7 +260,7 @@ SELECT
organization_id, organization_id,
document_id, document_id,
title, title,
owner_profile_id, approver_profile_id,
version_number, version_number,
classification, classification,
content, content,
@@ -313,7 +313,7 @@ SELECT
organization_id, organization_id,
document_id, document_id,
title, title,
owner_profile_id, approver_profile_id,
version_number, version_number,
classification, classification,
content, content,
@@ -364,7 +364,7 @@ SELECT
organization_id, organization_id,
document_id, document_id,
title, title,
owner_profile_id, approver_profile_id,
version_number, version_number,
classification, classification,
content, content,
@@ -413,7 +413,7 @@ func (dv DocumentVersion) Update(
q := ` q := `
UPDATE document_versions SET UPDATE document_versions SET
title = @title, title = @title,
owner_profile_id = @owner_profile_id, approver_profile_id = @approver_profile_id,
changelog = @changelog, changelog = @changelog,
status = @status, status = @status,
content = @content, content = @content,
@@ -429,7 +429,7 @@ WHERE %s
args := pgx.StrictNamedArgs{ args := pgx.StrictNamedArgs{
"document_version_id": dv.ID, "document_version_id": dv.ID,
"title": dv.Title, "title": dv.Title,
"owner_profile_id": dv.OwnerID, "approver_profile_id": dv.ApproverID,
"changelog": dv.Changelog, "changelog": dv.Changelog,
"status": dv.Status, "status": dv.Status,
"content": dv.Content, "content": dv.Content,

View File

@@ -0,0 +1,5 @@
-- Rename owner_profile_id to approver_profile_id on documents table
ALTER TABLE documents RENAME COLUMN owner_profile_id TO approver_profile_id;
-- Rename owner_profile_id to approver_profile_id on document_versions table
ALTER TABLE document_versions RENAME COLUMN owner_profile_id TO approver_profile_id;

View File

@@ -50,7 +50,7 @@ type (
OrganizationID gid.GID OrganizationID gid.GID
Title string Title string
Content string Content string
OwnerID gid.GID ApproverID gid.GID
Classification coredata.DocumentClassification Classification coredata.DocumentClassification
DocumentType coredata.DocumentType DocumentType coredata.DocumentType
TrustCenterVisibility *coredata.TrustCenterVisibility TrustCenterVisibility *coredata.TrustCenterVisibility
@@ -59,7 +59,7 @@ type (
UpdateDocumentRequest struct { UpdateDocumentRequest struct {
DocumentID gid.GID DocumentID gid.GID
Title *string Title *string
OwnerID *gid.GID ApproverID *gid.GID
Classification *coredata.DocumentClassification Classification *coredata.DocumentClassification
DocumentType *coredata.DocumentType DocumentType *coredata.DocumentType
TrustCenterVisibility *coredata.TrustCenterVisibility TrustCenterVisibility *coredata.TrustCenterVisibility
@@ -102,7 +102,7 @@ func (cdr *CreateDocumentRequest) Validate() error {
v.Check(cdr.OrganizationID, "organization_id", validator.Required(), validator.GID(coredata.OrganizationEntityType)) v.Check(cdr.OrganizationID, "organization_id", validator.Required(), validator.GID(coredata.OrganizationEntityType))
v.Check(cdr.Title, "title", validator.Required(), validator.SafeTextNoNewLine(TitleMaxLength)) v.Check(cdr.Title, "title", validator.Required(), validator.SafeTextNoNewLine(TitleMaxLength))
v.Check(cdr.Content, "content", validator.Required(), validator.NotEmpty(), validator.MaxLen(documentMaxLength)) v.Check(cdr.Content, "content", validator.Required(), validator.NotEmpty(), validator.MaxLen(documentMaxLength))
v.Check(cdr.OwnerID, "owner_id", validator.Required(), validator.GID(coredata.MembershipProfileEntityType)) v.Check(cdr.ApproverID, "approver_id", validator.Required(), validator.GID(coredata.MembershipProfileEntityType))
v.Check(cdr.Classification, "classification", validator.Required(), validator.OneOfSlice(coredata.DocumentClassifications())) v.Check(cdr.Classification, "classification", validator.Required(), validator.OneOfSlice(coredata.DocumentClassifications()))
v.Check(cdr.DocumentType, "document_type", validator.Required(), validator.OneOfSlice(coredata.DocumentTypes())) v.Check(cdr.DocumentType, "document_type", validator.Required(), validator.OneOfSlice(coredata.DocumentTypes()))
v.Check(cdr.TrustCenterVisibility, "trust_center_visibility", validator.OneOfSlice(coredata.TrustCenterVisibilities())) v.Check(cdr.TrustCenterVisibility, "trust_center_visibility", validator.OneOfSlice(coredata.TrustCenterVisibilities()))
@@ -115,7 +115,7 @@ func (udr *UpdateDocumentRequest) Validate() error {
v.Check(udr.DocumentID, "document_id", validator.Required(), validator.GID(coredata.DocumentEntityType)) v.Check(udr.DocumentID, "document_id", validator.Required(), validator.GID(coredata.DocumentEntityType))
v.Check(udr.Title, "title", validator.SafeTextNoNewLine(TitleMaxLength)) v.Check(udr.Title, "title", validator.SafeTextNoNewLine(TitleMaxLength))
v.Check(udr.OwnerID, "owner_id", validator.GID(coredata.MembershipProfileEntityType)) v.Check(udr.ApproverID, "approver_id", validator.GID(coredata.MembershipProfileEntityType))
v.Check(udr.Classification, "classification", validator.OneOfSlice(coredata.DocumentClassifications())) v.Check(udr.Classification, "classification", validator.OneOfSlice(coredata.DocumentClassifications()))
v.Check(udr.DocumentType, "document_type", validator.OneOfSlice(coredata.DocumentTypes())) v.Check(udr.DocumentType, "document_type", validator.OneOfSlice(coredata.DocumentTypes()))
v.Check(udr.TrustCenterVisibility, "trust_center_visibility", validator.OneOfSlice(coredata.TrustCenterVisibilities())) v.Check(udr.TrustCenterVisibility, "trust_center_visibility", validator.OneOfSlice(coredata.TrustCenterVisibilities()))
@@ -355,7 +355,7 @@ func (s *DocumentService) publishVersionInTx(
} }
if publishedVersion.Content == documentVersion.Content && if publishedVersion.Content == documentVersion.Content &&
publishedVersion.Title == documentVersion.Title && publishedVersion.Title == documentVersion.Title &&
publishedVersion.OwnerID == documentVersion.OwnerID { publishedVersion.ApproverID == documentVersion.ApproverID {
return nil, nil, &ErrDocumentVersionNoChanges{} return nil, nil, &ErrDocumentVersionNoChanges{}
} }
} }
@@ -395,7 +395,7 @@ func (s *DocumentService) Create(
documentVersionID := gid.New(s.svc.scope.GetTenantID(), coredata.DocumentVersionEntityType) documentVersionID := gid.New(s.svc.scope.GetTenantID(), coredata.DocumentVersionEntityType)
organization := &coredata.Organization{} organization := &coredata.Organization{}
owner := &coredata.MembershipProfile{} approver := &coredata.MembershipProfile{}
document := &coredata.Document{ document := &coredata.Document{
ID: documentID, ID: documentID,
@@ -415,7 +415,7 @@ func (s *DocumentService) Create(
ID: documentVersionID, ID: documentVersionID,
DocumentID: documentID, DocumentID: documentID,
Title: req.Title, Title: req.Title,
OwnerID: req.OwnerID, ApproverID: req.ApproverID,
VersionNumber: 1, VersionNumber: 1,
Content: req.Content, Content: req.Content,
Status: coredata.DocumentStatusDraft, Status: coredata.DocumentStatusDraft,
@@ -431,12 +431,12 @@ func (s *DocumentService) Create(
return fmt.Errorf("cannot load organization: %w", err) return fmt.Errorf("cannot load organization: %w", err)
} }
if err := owner.LoadByID(ctx, conn, s.svc.scope, req.OwnerID); err != nil { if err := approver.LoadByID(ctx, conn, s.svc.scope, req.ApproverID); err != nil {
return fmt.Errorf("cannot load owner profile: %w", err) return fmt.Errorf("cannot load approver profile: %w", err)
} }
document.OrganizationID = organization.ID document.OrganizationID = organization.ID
document.OwnerID = owner.ID document.ApproverID = approver.ID
if err := document.Insert(ctx, conn, s.svc.scope); err != nil { if err := document.Insert(ctx, conn, s.svc.scope); err != nil {
return fmt.Errorf("cannot insert document: %w", err) return fmt.Errorf("cannot insert document: %w", err)
@@ -706,7 +706,7 @@ func (s *DocumentService) UpdateVersion(
} }
documentVersion.Title = document.Title documentVersion.Title = document.Title
documentVersion.OwnerID = document.OwnerID documentVersion.ApproverID = document.ApproverID
documentVersion.Classification = document.Classification documentVersion.Classification = document.Classification
documentVersion.Content = req.Content documentVersion.Content = req.Content
documentVersion.UpdatedAt = time.Now() documentVersion.UpdatedAt = time.Now()
@@ -944,7 +944,7 @@ func (s *DocumentService) CreateDraft(
draftVersion.OrganizationID = document.OrganizationID draftVersion.OrganizationID = document.OrganizationID
draftVersion.DocumentID = documentID draftVersion.DocumentID = documentID
draftVersion.Title = document.Title draftVersion.Title = document.Title
draftVersion.OwnerID = document.OwnerID draftVersion.ApproverID = document.ApproverID
draftVersion.VersionNumber = latestVersion.VersionNumber + 1 draftVersion.VersionNumber = latestVersion.VersionNumber + 1
draftVersion.Classification = document.Classification draftVersion.Classification = document.Classification
draftVersion.Content = latestVersion.Content draftVersion.Content = latestVersion.Content
@@ -1384,7 +1384,7 @@ func (s *DocumentService) Update(
} }
document := &coredata.Document{} document := &coredata.Document{}
owner := &coredata.MembershipProfile{} approver := &coredata.MembershipProfile{}
now := time.Now() now := time.Now()
err := s.svc.pg.WithTx( err := s.svc.pg.WithTx(
@@ -1414,11 +1414,11 @@ func (s *DocumentService) Update(
document.TrustCenterVisibility = *req.TrustCenterVisibility document.TrustCenterVisibility = *req.TrustCenterVisibility
} }
if req.OwnerID != nil { if req.ApproverID != nil {
if err := owner.LoadByID(ctx, tx, s.svc.scope, *req.OwnerID); err != nil { if err := approver.LoadByID(ctx, tx, s.svc.scope, *req.ApproverID); err != nil {
return fmt.Errorf("cannot load owner profile %q: %w", *req.OwnerID, err) return fmt.Errorf("cannot load approver profile %q: %w", *req.ApproverID, err)
} }
document.OwnerID = owner.ID document.ApproverID = approver.ID
} }
document.UpdatedAt = now document.UpdatedAt = now
@@ -1432,7 +1432,7 @@ func (s *DocumentService) Update(
err := draftVersion.LoadLatestVersion(ctx, tx, s.svc.scope, req.DocumentID) err := draftVersion.LoadLatestVersion(ctx, tx, s.svc.scope, req.DocumentID)
if err == nil && draftVersion.Status == coredata.DocumentStatusDraft { if err == nil && draftVersion.Status == coredata.DocumentStatusDraft {
draftVersion.Title = document.Title draftVersion.Title = document.Title
draftVersion.OwnerID = document.OwnerID draftVersion.ApproverID = document.ApproverID
draftVersion.Classification = document.Classification draftVersion.Classification = document.Classification
draftVersion.UpdatedAt = now draftVersion.UpdatedAt = now
@@ -1638,7 +1638,7 @@ func exportDocumentPDF(
) ([]byte, error) { ) ([]byte, error) {
document := &coredata.Document{} document := &coredata.Document{}
version := &coredata.DocumentVersion{} version := &coredata.DocumentVersion{}
owner := &coredata.MembershipProfile{} approver := &coredata.MembershipProfile{}
organization := &coredata.Organization{} organization := &coredata.Organization{}
if err := version.LoadByID(ctx, conn, scope, documentVersionID); err != nil { if err := version.LoadByID(ctx, conn, scope, documentVersionID); err != nil {
@@ -1649,8 +1649,8 @@ func exportDocumentPDF(
return nil, fmt.Errorf("cannot load document: %w", err) return nil, fmt.Errorf("cannot load document: %w", err)
} }
if err := owner.LoadByID(ctx, conn, scope, document.OwnerID); err != nil { if err := approver.LoadByID(ctx, conn, scope, document.ApproverID); err != nil {
return nil, fmt.Errorf("cannot load document owner profile: %w", err) return nil, fmt.Errorf("cannot load document approver profile: %w", err)
} }
if err := organization.LoadByID(ctx, conn, scope, document.OrganizationID); err != nil { if err := organization.LoadByID(ctx, conn, scope, document.OrganizationID); err != nil {
@@ -1702,7 +1702,7 @@ func exportDocumentPDF(
Content: version.Content, Content: version.Content,
Version: version.VersionNumber, Version: version.VersionNumber,
Classification: classification, Classification: classification,
Approver: owner.FullName, Approver: approver.FullName,
PublishedAt: version.PublishedAt, PublishedAt: version.PublishedAt,
Signatures: signatureData, Signatures: signatureData,
CompanyHorizontalLogoBase64: horizontalLogoBase64, CompanyHorizontalLogoBase64: horizontalLogoBase64,

View File

@@ -2208,7 +2208,7 @@ type Document implements Node {
classification: DocumentClassification! classification: DocumentClassification!
currentPublishedVersion: Int currentPublishedVersion: Int
trustCenterVisibility: TrustCenterVisibility! trustCenterVisibility: TrustCenterVisibility!
owner: Profile! @goField(forceResolver: true) approver: Profile! @goField(forceResolver: true)
organization: Organization! @goField(forceResolver: true) organization: Organization! @goField(forceResolver: true)
versions( versions(
@@ -4018,7 +4018,7 @@ input CreateDocumentInput {
organizationId: ID! organizationId: ID!
title: String! title: String!
content: String! content: String!
ownerId: ID! approverId: ID!
documentType: DocumentType! documentType: DocumentType!
classification: DocumentClassification! classification: DocumentClassification!
trustCenterVisibility: TrustCenterVisibility trustCenterVisibility: TrustCenterVisibility
@@ -4028,7 +4028,7 @@ input UpdateDocumentInput {
id: ID! id: ID!
title: String title: String
content: String content: String
ownerId: ID approverId: ID
documentType: DocumentType documentType: DocumentType
classification: DocumentClassification classification: DocumentClassification
trustCenterVisibility: TrustCenterVisibility trustCenterVisibility: TrustCenterVisibility
@@ -4862,7 +4862,7 @@ type DocumentVersion implements Node {
changelog: String! changelog: String!
title: String! title: String!
classification: DocumentClassification! classification: DocumentClassification!
owner: Profile! @goField(forceResolver: true) approver: Profile! @goField(forceResolver: true)
signatures( signatures(
first: Int first: Int

View File

@@ -702,6 +702,7 @@ type ComplexityRoot struct {
} }
Document struct { Document struct {
Approver func(childComplexity int) int
Classification func(childComplexity int) int Classification func(childComplexity int) int
Controls func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy, filter *types.ControlFilter) int Controls func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy, filter *types.ControlFilter) int
CreatedAt func(childComplexity int) int CreatedAt func(childComplexity int) int
@@ -710,7 +711,6 @@ type ComplexityRoot struct {
DocumentType func(childComplexity int) int DocumentType func(childComplexity int) int
ID func(childComplexity int) int ID func(childComplexity int) int
Organization func(childComplexity int) int Organization func(childComplexity int) int
Owner func(childComplexity int) int
Permission func(childComplexity int, action string) int Permission func(childComplexity int, action string) int
Title func(childComplexity int) int Title func(childComplexity int) int
TrustCenterVisibility func(childComplexity int) int TrustCenterVisibility func(childComplexity int) int
@@ -730,13 +730,13 @@ type ComplexityRoot struct {
} }
DocumentVersion struct { DocumentVersion struct {
Approver func(childComplexity int) int
Changelog func(childComplexity int) int Changelog func(childComplexity int) int
Classification func(childComplexity int) int Classification func(childComplexity int) int
Content func(childComplexity int) int Content func(childComplexity int) int
CreatedAt func(childComplexity int) int CreatedAt func(childComplexity int) int
Document func(childComplexity int) int Document func(childComplexity int) int
ID func(childComplexity int) int ID func(childComplexity int) int
Owner func(childComplexity int) int
Permission func(childComplexity int, action string) int Permission func(childComplexity int, action string) int
PublishedAt func(childComplexity int) int PublishedAt func(childComplexity int) int
Signatures func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentVersionSignatureOrder, filter *types.DocumentVersionSignatureFilter) int Signatures func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentVersionSignatureOrder, filter *types.DocumentVersionSignatureFilter) int
@@ -2058,7 +2058,7 @@ type DatumConnectionResolver interface {
TotalCount(ctx context.Context, obj *types.DatumConnection) (int, error) TotalCount(ctx context.Context, obj *types.DatumConnection) (int, error)
} }
type DocumentResolver interface { type DocumentResolver interface {
Owner(ctx context.Context, obj *types.Document) (*types.Profile, error) Approver(ctx context.Context, obj *types.Document) (*types.Profile, error)
Organization(ctx context.Context, obj *types.Document) (*types.Organization, error) Organization(ctx context.Context, obj *types.Document) (*types.Organization, error)
Versions(ctx context.Context, obj *types.Document, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentVersionOrderBy, filter *types.DocumentVersionFilter) (*types.DocumentVersionConnection, error) Versions(ctx context.Context, obj *types.Document, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentVersionOrderBy, filter *types.DocumentVersionFilter) (*types.DocumentVersionConnection, error)
Controls(ctx context.Context, obj *types.Document, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy, filter *types.ControlFilter) (*types.ControlConnection, error) Controls(ctx context.Context, obj *types.Document, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy, filter *types.ControlFilter) (*types.ControlConnection, error)
@@ -2071,7 +2071,7 @@ type DocumentConnectionResolver interface {
type DocumentVersionResolver interface { type DocumentVersionResolver interface {
Document(ctx context.Context, obj *types.DocumentVersion) (*types.Document, error) Document(ctx context.Context, obj *types.DocumentVersion) (*types.Document, error)
Owner(ctx context.Context, obj *types.DocumentVersion) (*types.Profile, error) Approver(ctx context.Context, obj *types.DocumentVersion) (*types.Profile, error)
Signatures(ctx context.Context, obj *types.DocumentVersion, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentVersionSignatureOrder, filter *types.DocumentVersionSignatureFilter) (*types.DocumentVersionSignatureConnection, error) Signatures(ctx context.Context, obj *types.DocumentVersion, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentVersionSignatureOrder, filter *types.DocumentVersionSignatureFilter) (*types.DocumentVersionSignatureConnection, error)
Signed(ctx context.Context, obj *types.DocumentVersion) (bool, error) Signed(ctx context.Context, obj *types.DocumentVersion) (bool, error)
@@ -4208,6 +4208,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.DeleteWebhookSubscriptionPayload.DeletedWebhookSubscriptionID(childComplexity), true return e.complexity.DeleteWebhookSubscriptionPayload.DeletedWebhookSubscriptionID(childComplexity), true
case "Document.approver":
if e.complexity.Document.Approver == nil {
break
}
return e.complexity.Document.Approver(childComplexity), true
case "Document.classification": case "Document.classification":
if e.complexity.Document.Classification == nil { if e.complexity.Document.Classification == nil {
break break
@@ -4261,12 +4267,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
} }
return e.complexity.Document.Organization(childComplexity), true return e.complexity.Document.Organization(childComplexity), true
case "Document.owner":
if e.complexity.Document.Owner == nil {
break
}
return e.complexity.Document.Owner(childComplexity), true
case "Document.permission": case "Document.permission":
if e.complexity.Document.Permission == nil { if e.complexity.Document.Permission == nil {
break break
@@ -4340,6 +4340,12 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
return e.complexity.DocumentEdge.Node(childComplexity), true return e.complexity.DocumentEdge.Node(childComplexity), true
case "DocumentVersion.approver":
if e.complexity.DocumentVersion.Approver == nil {
break
}
return e.complexity.DocumentVersion.Approver(childComplexity), true
case "DocumentVersion.changelog": case "DocumentVersion.changelog":
if e.complexity.DocumentVersion.Changelog == nil { if e.complexity.DocumentVersion.Changelog == nil {
break break
@@ -4376,12 +4382,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
} }
return e.complexity.DocumentVersion.ID(childComplexity), true return e.complexity.DocumentVersion.ID(childComplexity), true
case "DocumentVersion.owner":
if e.complexity.DocumentVersion.Owner == nil {
break
}
return e.complexity.DocumentVersion.Owner(childComplexity), true
case "DocumentVersion.permission": case "DocumentVersion.permission":
if e.complexity.DocumentVersion.Permission == nil { if e.complexity.DocumentVersion.Permission == nil {
break break
@@ -12795,7 +12795,7 @@ type Document implements Node {
classification: DocumentClassification! classification: DocumentClassification!
currentPublishedVersion: Int currentPublishedVersion: Int
trustCenterVisibility: TrustCenterVisibility! trustCenterVisibility: TrustCenterVisibility!
owner: Profile! @goField(forceResolver: true) approver: Profile! @goField(forceResolver: true)
organization: Organization! @goField(forceResolver: true) organization: Organization! @goField(forceResolver: true)
versions( versions(
@@ -14605,7 +14605,7 @@ input CreateDocumentInput {
organizationId: ID! organizationId: ID!
title: String! title: String!
content: String! content: String!
ownerId: ID! approverId: ID!
documentType: DocumentType! documentType: DocumentType!
classification: DocumentClassification! classification: DocumentClassification!
trustCenterVisibility: TrustCenterVisibility trustCenterVisibility: TrustCenterVisibility
@@ -14615,7 +14615,7 @@ input UpdateDocumentInput {
id: ID! id: ID!
title: String title: String
content: String content: String
ownerId: ID approverId: ID
documentType: DocumentType documentType: DocumentType
classification: DocumentClassification classification: DocumentClassification
trustCenterVisibility: TrustCenterVisibility trustCenterVisibility: TrustCenterVisibility
@@ -15449,7 +15449,7 @@ type DocumentVersion implements Node {
changelog: String! changelog: String!
title: String! title: String!
classification: DocumentClassification! classification: DocumentClassification!
owner: Profile! @goField(forceResolver: true) approver: Profile! @goField(forceResolver: true)
signatures( signatures(
first: Int first: Int
@@ -29115,14 +29115,14 @@ func (ec *executionContext) fieldContext_Document_trustCenterVisibility(_ contex
return fc, nil return fc, nil
} }
func (ec *executionContext) _Document_owner(ctx context.Context, field graphql.CollectedField, obj *types.Document) (ret graphql.Marshaler) { func (ec *executionContext) _Document_approver(ctx context.Context, field graphql.CollectedField, obj *types.Document) (ret graphql.Marshaler) {
return graphql.ResolveField( return graphql.ResolveField(
ctx, ctx,
ec.OperationContext, ec.OperationContext,
field, field,
ec.fieldContext_Document_owner, ec.fieldContext_Document_approver,
func(ctx context.Context) (any, error) { func(ctx context.Context) (any, error) {
return ec.resolvers.Document().Owner(ctx, obj) return ec.resolvers.Document().Approver(ctx, obj)
}, },
nil, nil,
ec.marshalNProfile2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐProfile, ec.marshalNProfile2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐProfile,
@@ -29131,7 +29131,7 @@ func (ec *executionContext) _Document_owner(ctx context.Context, field graphql.C
) )
} }
func (ec *executionContext) fieldContext_Document_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_Document_approver(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{ fc = &graphql.FieldContext{
Object: "Document", Object: "Document",
Field: field, Field: field,
@@ -29642,8 +29642,8 @@ func (ec *executionContext) fieldContext_DocumentEdge_node(_ context.Context, fi
return ec.fieldContext_Document_currentPublishedVersion(ctx, field) return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
case "trustCenterVisibility": case "trustCenterVisibility":
return ec.fieldContext_Document_trustCenterVisibility(ctx, field) return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
case "owner": case "approver":
return ec.fieldContext_Document_owner(ctx, field) return ec.fieldContext_Document_approver(ctx, field)
case "organization": case "organization":
return ec.fieldContext_Document_organization(ctx, field) return ec.fieldContext_Document_organization(ctx, field)
case "versions": case "versions":
@@ -29730,8 +29730,8 @@ func (ec *executionContext) fieldContext_DocumentVersion_document(_ context.Cont
return ec.fieldContext_Document_currentPublishedVersion(ctx, field) return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
case "trustCenterVisibility": case "trustCenterVisibility":
return ec.fieldContext_Document_trustCenterVisibility(ctx, field) return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
case "owner": case "approver":
return ec.fieldContext_Document_owner(ctx, field) return ec.fieldContext_Document_approver(ctx, field)
case "organization": case "organization":
return ec.fieldContext_Document_organization(ctx, field) return ec.fieldContext_Document_organization(ctx, field)
case "versions": case "versions":
@@ -29925,14 +29925,14 @@ func (ec *executionContext) fieldContext_DocumentVersion_classification(_ contex
return fc, nil return fc, nil
} }
func (ec *executionContext) _DocumentVersion_owner(ctx context.Context, field graphql.CollectedField, obj *types.DocumentVersion) (ret graphql.Marshaler) { func (ec *executionContext) _DocumentVersion_approver(ctx context.Context, field graphql.CollectedField, obj *types.DocumentVersion) (ret graphql.Marshaler) {
return graphql.ResolveField( return graphql.ResolveField(
ctx, ctx,
ec.OperationContext, ec.OperationContext,
field, field,
ec.fieldContext_DocumentVersion_owner, ec.fieldContext_DocumentVersion_approver,
func(ctx context.Context) (any, error) { func(ctx context.Context) (any, error) {
return ec.resolvers.DocumentVersion().Owner(ctx, obj) return ec.resolvers.DocumentVersion().Approver(ctx, obj)
}, },
nil, nil,
ec.marshalNProfile2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐProfile, ec.marshalNProfile2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐProfile,
@@ -29941,7 +29941,7 @@ func (ec *executionContext) _DocumentVersion_owner(ctx context.Context, field gr
) )
} }
func (ec *executionContext) fieldContext_DocumentVersion_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { func (ec *executionContext) fieldContext_DocumentVersion_approver(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{ fc = &graphql.FieldContext{
Object: "DocumentVersion", Object: "DocumentVersion",
Field: field, Field: field,
@@ -30356,8 +30356,8 @@ func (ec *executionContext) fieldContext_DocumentVersionEdge_node(_ context.Cont
return ec.fieldContext_DocumentVersion_title(ctx, field) return ec.fieldContext_DocumentVersion_title(ctx, field)
case "classification": case "classification":
return ec.fieldContext_DocumentVersion_classification(ctx, field) return ec.fieldContext_DocumentVersion_classification(ctx, field)
case "owner": case "approver":
return ec.fieldContext_DocumentVersion_owner(ctx, field) return ec.fieldContext_DocumentVersion_approver(ctx, field)
case "signatures": case "signatures":
return ec.fieldContext_DocumentVersion_signatures(ctx, field) return ec.fieldContext_DocumentVersion_signatures(ctx, field)
case "signed": case "signed":
@@ -30446,8 +30446,8 @@ func (ec *executionContext) fieldContext_DocumentVersionSignature_documentVersio
return ec.fieldContext_DocumentVersion_title(ctx, field) return ec.fieldContext_DocumentVersion_title(ctx, field)
case "classification": case "classification":
return ec.fieldContext_DocumentVersion_classification(ctx, field) return ec.fieldContext_DocumentVersion_classification(ctx, field)
case "owner": case "approver":
return ec.fieldContext_DocumentVersion_owner(ctx, field) return ec.fieldContext_DocumentVersion_approver(ctx, field)
case "signatures": case "signatures":
return ec.fieldContext_DocumentVersion_signatures(ctx, field) return ec.fieldContext_DocumentVersion_signatures(ctx, field)
case "signed": case "signed":
@@ -45461,8 +45461,8 @@ func (ec *executionContext) fieldContext_PublishDocumentVersionPayload_documentV
return ec.fieldContext_DocumentVersion_title(ctx, field) return ec.fieldContext_DocumentVersion_title(ctx, field)
case "classification": case "classification":
return ec.fieldContext_DocumentVersion_classification(ctx, field) return ec.fieldContext_DocumentVersion_classification(ctx, field)
case "owner": case "approver":
return ec.fieldContext_DocumentVersion_owner(ctx, field) return ec.fieldContext_DocumentVersion_approver(ctx, field)
case "signatures": case "signatures":
return ec.fieldContext_DocumentVersion_signatures(ctx, field) return ec.fieldContext_DocumentVersion_signatures(ctx, field)
case "signed": case "signed":
@@ -45520,8 +45520,8 @@ func (ec *executionContext) fieldContext_PublishDocumentVersionPayload_document(
return ec.fieldContext_Document_currentPublishedVersion(ctx, field) return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
case "trustCenterVisibility": case "trustCenterVisibility":
return ec.fieldContext_Document_trustCenterVisibility(ctx, field) return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
case "owner": case "approver":
return ec.fieldContext_Document_owner(ctx, field) return ec.fieldContext_Document_approver(ctx, field)
case "organization": case "organization":
return ec.fieldContext_Document_organization(ctx, field) return ec.fieldContext_Document_organization(ctx, field)
case "versions": case "versions":
@@ -52250,8 +52250,8 @@ func (ec *executionContext) fieldContext_TrustCenterDocumentAccess_document(_ co
return ec.fieldContext_Document_currentPublishedVersion(ctx, field) return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
case "trustCenterVisibility": case "trustCenterVisibility":
return ec.fieldContext_Document_trustCenterVisibility(ctx, field) return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
case "owner": case "approver":
return ec.fieldContext_Document_owner(ctx, field) return ec.fieldContext_Document_approver(ctx, field)
case "organization": case "organization":
return ec.fieldContext_Document_organization(ctx, field) return ec.fieldContext_Document_organization(ctx, field)
case "versions": case "versions":
@@ -54047,8 +54047,8 @@ func (ec *executionContext) fieldContext_UpdateDocumentPayload_document(_ contex
return ec.fieldContext_Document_currentPublishedVersion(ctx, field) return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
case "trustCenterVisibility": case "trustCenterVisibility":
return ec.fieldContext_Document_trustCenterVisibility(ctx, field) return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
case "owner": case "approver":
return ec.fieldContext_Document_owner(ctx, field) return ec.fieldContext_Document_approver(ctx, field)
case "organization": case "organization":
return ec.fieldContext_Document_organization(ctx, field) return ec.fieldContext_Document_organization(ctx, field)
case "versions": case "versions":
@@ -54108,8 +54108,8 @@ func (ec *executionContext) fieldContext_UpdateDocumentVersionPayload_documentVe
return ec.fieldContext_DocumentVersion_title(ctx, field) return ec.fieldContext_DocumentVersion_title(ctx, field)
case "classification": case "classification":
return ec.fieldContext_DocumentVersion_classification(ctx, field) return ec.fieldContext_DocumentVersion_classification(ctx, field)
case "owner": case "approver":
return ec.fieldContext_DocumentVersion_owner(ctx, field) return ec.fieldContext_DocumentVersion_approver(ctx, field)
case "signatures": case "signatures":
return ec.fieldContext_DocumentVersion_signatures(ctx, field) return ec.fieldContext_DocumentVersion_signatures(ctx, field)
case "signed": case "signed":
@@ -63387,7 +63387,7 @@ func (ec *executionContext) unmarshalInputCreateDocumentInput(ctx context.Contex
asMap[k] = v asMap[k] = v
} }
fieldsInOrder := [...]string{"organizationId", "title", "content", "ownerId", "documentType", "classification", "trustCenterVisibility"} fieldsInOrder := [...]string{"organizationId", "title", "content", "approverId", "documentType", "classification", "trustCenterVisibility"}
for _, k := range fieldsInOrder { for _, k := range fieldsInOrder {
v, ok := asMap[k] v, ok := asMap[k]
if !ok { if !ok {
@@ -63415,13 +63415,13 @@ func (ec *executionContext) unmarshalInputCreateDocumentInput(ctx context.Contex
return it, err return it, err
} }
it.Content = data it.Content = data
case "ownerId": case "approverId":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerId")) ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("approverId"))
data, err := ec.unmarshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID(ctx, v) data, err := ec.unmarshalNID2goᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID(ctx, v)
if err != nil { if err != nil {
return it, err return it, err
} }
it.OwnerID = data it.ApproverID = data
case "documentType": case "documentType":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("documentType")) ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("documentType"))
data, err := ec.unmarshalNDocumentType2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐDocumentType(ctx, v) data, err := ec.unmarshalNDocumentType2goᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐDocumentType(ctx, v)
@@ -68341,7 +68341,7 @@ func (ec *executionContext) unmarshalInputUpdateDocumentInput(ctx context.Contex
asMap[k] = v asMap[k] = v
} }
fieldsInOrder := [...]string{"id", "title", "content", "ownerId", "documentType", "classification", "trustCenterVisibility"} fieldsInOrder := [...]string{"id", "title", "content", "approverId", "documentType", "classification", "trustCenterVisibility"}
for _, k := range fieldsInOrder { for _, k := range fieldsInOrder {
v, ok := asMap[k] v, ok := asMap[k]
if !ok { if !ok {
@@ -68369,13 +68369,13 @@ func (ec *executionContext) unmarshalInputUpdateDocumentInput(ctx context.Contex
return it, err return it, err
} }
it.Content = data it.Content = data
case "ownerId": case "approverId":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerId")) ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("approverId"))
data, err := ec.unmarshalOID2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID(ctx, v) data, err := ec.unmarshalOID2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋgidᚐGID(ctx, v)
if err != nil { if err != nil {
return it, err return it, err
} }
it.OwnerID = data it.ApproverID = data
case "documentType": case "documentType":
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("documentType")) ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("documentType"))
data, err := ec.unmarshalODocumentType2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐDocumentType(ctx, v) data, err := ec.unmarshalODocumentType2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐDocumentType(ctx, v)
@@ -77056,7 +77056,7 @@ func (ec *executionContext) _Document(ctx context.Context, sel ast.SelectionSet,
if out.Values[i] == graphql.Null { if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1) atomic.AddUint32(&out.Invalids, 1)
} }
case "owner": case "approver":
field := field field := field
innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
@@ -77065,7 +77065,7 @@ func (ec *executionContext) _Document(ctx context.Context, sel ast.SelectionSet,
ec.Error(ctx, ec.Recover(ctx, r)) ec.Error(ctx, ec.Recover(ctx, r))
} }
}() }()
res = ec._Document_owner(ctx, field, obj) res = ec._Document_approver(ctx, field, obj)
if res == graphql.Null { if res == graphql.Null {
atomic.AddUint32(&fs.Invalids, 1) atomic.AddUint32(&fs.Invalids, 1)
} }
@@ -77475,7 +77475,7 @@ func (ec *executionContext) _DocumentVersion(ctx context.Context, sel ast.Select
if out.Values[i] == graphql.Null { if out.Values[i] == graphql.Null {
atomic.AddUint32(&out.Invalids, 1) atomic.AddUint32(&out.Invalids, 1)
} }
case "owner": case "approver":
field := field field := field
innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) {
@@ -77484,7 +77484,7 @@ func (ec *executionContext) _DocumentVersion(ctx context.Context, sel ast.Select
ec.Error(ctx, ec.Recover(ctx, r)) ec.Error(ctx, ec.Recover(ctx, r))
} }
}() }()
res = ec._DocumentVersion_owner(ctx, field, obj) res = ec._DocumentVersion_approver(ctx, field, obj)
if res == graphql.Null { if res == graphql.Null {
atomic.AddUint32(&fs.Invalids, 1) atomic.AddUint32(&fs.Invalids, 1)
} }

View File

@@ -80,8 +80,8 @@ func NewDocument(document *coredata.Document) *Document {
Organization: &Organization{ Organization: &Organization{
ID: document.OrganizationID, ID: document.OrganizationID,
}, },
Owner: &Profile{ Approver: &Profile{
ID: document.OwnerID, ID: document.ApproverID,
}, },
DocumentType: document.DocumentType, DocumentType: document.DocumentType,
Classification: document.Classification, Classification: document.Classification,

View File

@@ -76,8 +76,8 @@ func NewDocumentVersion(documentVersion *coredata.DocumentVersion) *DocumentVers
Document: &Document{ Document: &Document{
ID: documentVersion.DocumentID, ID: documentVersion.DocumentID,
}, },
Owner: &Profile{ Approver: &Profile{
ID: documentVersion.OwnerID, ID: documentVersion.ApproverID,
}, },
Version: documentVersion.VersionNumber, Version: documentVersion.VersionNumber,
Title: documentVersion.Title, Title: documentVersion.Title,

View File

@@ -369,7 +369,7 @@ type CreateDocumentInput struct {
OrganizationID gid.GID `json:"organizationId"` OrganizationID gid.GID `json:"organizationId"`
Title string `json:"title"` Title string `json:"title"`
Content string `json:"content"` Content string `json:"content"`
OwnerID gid.GID `json:"ownerId"` ApproverID gid.GID `json:"approverId"`
DocumentType coredata.DocumentType `json:"documentType"` DocumentType coredata.DocumentType `json:"documentType"`
Classification coredata.DocumentClassification `json:"classification"` Classification coredata.DocumentClassification `json:"classification"`
TrustCenterVisibility *coredata.TrustCenterVisibility `json:"trustCenterVisibility,omitempty"` TrustCenterVisibility *coredata.TrustCenterVisibility `json:"trustCenterVisibility,omitempty"`
@@ -1129,7 +1129,7 @@ type Document struct {
Classification coredata.DocumentClassification `json:"classification"` Classification coredata.DocumentClassification `json:"classification"`
CurrentPublishedVersion *int `json:"currentPublishedVersion,omitempty"` CurrentPublishedVersion *int `json:"currentPublishedVersion,omitempty"`
TrustCenterVisibility coredata.TrustCenterVisibility `json:"trustCenterVisibility"` TrustCenterVisibility coredata.TrustCenterVisibility `json:"trustCenterVisibility"`
Owner *Profile `json:"owner"` Approver *Profile `json:"approver"`
Organization *Organization `json:"organization"` Organization *Organization `json:"organization"`
Versions *DocumentVersionConnection `json:"versions"` Versions *DocumentVersionConnection `json:"versions"`
Controls *ControlConnection `json:"controls"` Controls *ControlConnection `json:"controls"`
@@ -1159,7 +1159,7 @@ type DocumentVersion struct {
Changelog string `json:"changelog"` Changelog string `json:"changelog"`
Title string `json:"title"` Title string `json:"title"`
Classification coredata.DocumentClassification `json:"classification"` Classification coredata.DocumentClassification `json:"classification"`
Owner *Profile `json:"owner"` Approver *Profile `json:"approver"`
Signatures *DocumentVersionSignatureConnection `json:"signatures"` Signatures *DocumentVersionSignatureConnection `json:"signatures"`
Signed bool `json:"signed"` Signed bool `json:"signed"`
PublishedAt *time.Time `json:"publishedAt,omitempty"` PublishedAt *time.Time `json:"publishedAt,omitempty"`
@@ -2036,7 +2036,7 @@ type UpdateDocumentInput struct {
ID gid.GID `json:"id"` ID gid.GID `json:"id"`
Title *string `json:"title,omitempty"` Title *string `json:"title,omitempty"`
Content *string `json:"content,omitempty"` Content *string `json:"content,omitempty"`
OwnerID *gid.GID `json:"ownerId,omitempty"` ApproverID *gid.GID `json:"approverId,omitempty"`
DocumentType *coredata.DocumentType `json:"documentType,omitempty"` DocumentType *coredata.DocumentType `json:"documentType,omitempty"`
Classification *coredata.DocumentClassification `json:"classification,omitempty"` Classification *coredata.DocumentClassification `json:"classification,omitempty"`
TrustCenterVisibility *coredata.TrustCenterVisibility `json:"trustCenterVisibility,omitempty"` TrustCenterVisibility *coredata.TrustCenterVisibility `json:"trustCenterVisibility,omitempty"`

View File

@@ -862,23 +862,23 @@ func (r *datumConnectionResolver) TotalCount(ctx context.Context, obj *types.Dat
panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver)) panic(fmt.Errorf("unsupported resolver: %T", obj.Resolver))
} }
// Owner is the resolver for the owner field. // Approver is the resolver for the approver field.
func (r *documentResolver) Owner(ctx context.Context, obj *types.Document) (*types.Profile, error) { func (r *documentResolver) Approver(ctx context.Context, obj *types.Document) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, iam.ActionMembershipProfileGet); err != nil { if err := r.authorize(ctx, obj.ID, iam.ActionMembershipProfileGet); err != nil {
return nil, err return nil, err
} }
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID) approver, err := r.iam.OrganizationService.GetProfile(ctx, obj.Approver.ID)
if err != nil { if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) { if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err) return nil, gqlutils.NotFound(ctx, err)
} }
// TODO no panic use gqlutils.InternalError // TODO no panic use gqlutils.InternalError
panic(fmt.Errorf("cannot get owner: %w", err)) panic(fmt.Errorf("cannot get approver: %w", err))
} }
return types.NewProfile(owner), nil return types.NewProfile(approver), nil
} }
// Organization is the resolver for the organization field. // Organization is the resolver for the organization field.
@@ -1031,23 +1031,23 @@ func (r *documentVersionResolver) Document(ctx context.Context, obj *types.Docum
return types.NewDocument(document), nil return types.NewDocument(document), nil
} }
// Owner is the resolver for the owner field. // Approver is the resolver for the approver field.
func (r *documentVersionResolver) Owner(ctx context.Context, obj *types.DocumentVersion) (*types.Profile, error) { func (r *documentVersionResolver) Approver(ctx context.Context, obj *types.DocumentVersion) (*types.Profile, error) {
if err := r.authorize(ctx, obj.ID, iam.ActionMembershipProfileGet); err != nil { if err := r.authorize(ctx, obj.ID, iam.ActionMembershipProfileGet); err != nil {
return nil, err return nil, err
} }
owner, err := r.iam.OrganizationService.GetProfile(ctx, obj.Owner.ID) approver, err := r.iam.OrganizationService.GetProfile(ctx, obj.Approver.ID)
if err != nil { if err != nil {
if errors.Is(err, coredata.ErrResourceNotFound) { if errors.Is(err, coredata.ErrResourceNotFound) {
return nil, gqlutils.NotFound(ctx, err) return nil, gqlutils.NotFound(ctx, err)
} }
// TODO no panic use gqlutils.InternalError // TODO no panic use gqlutils.InternalError
panic(fmt.Errorf("cannot get owner: %w", err)) panic(fmt.Errorf("cannot get approver: %w", err))
} }
return types.NewProfile(owner), nil return types.NewProfile(approver), nil
} }
// Signatures is the resolver for the signatures field. // Signatures is the resolver for the signatures field.
@@ -3528,7 +3528,7 @@ func (r *mutationResolver) CreateDocument(ctx context.Context, input types.Creat
OrganizationID: input.OrganizationID, OrganizationID: input.OrganizationID,
DocumentType: input.DocumentType, DocumentType: input.DocumentType,
Title: input.Title, Title: input.Title,
OwnerID: input.OwnerID, ApproverID: input.ApproverID,
Content: input.Content, Content: input.Content,
Classification: input.Classification, Classification: input.Classification,
TrustCenterVisibility: input.TrustCenterVisibility, TrustCenterVisibility: input.TrustCenterVisibility,
@@ -3562,7 +3562,7 @@ func (r *mutationResolver) UpdateDocument(ctx context.Context, input types.Updat
probo.UpdateDocumentRequest{ probo.UpdateDocumentRequest{
DocumentID: input.ID, DocumentID: input.ID,
Title: input.Title, Title: input.Title,
OwnerID: input.OwnerID, ApproverID: input.ApproverID,
Classification: input.Classification, Classification: input.Classification,
DocumentType: input.DocumentType, DocumentType: input.DocumentType,
TrustCenterVisibility: input.TrustCenterVisibility, TrustCenterVisibility: input.TrustCenterVisibility,

View File

@@ -1592,7 +1592,7 @@ func (r *Resolver) AddDocumentTool(ctx context.Context, req *mcp.CallToolRequest
OrganizationID: input.OrganizationID, OrganizationID: input.OrganizationID,
Title: input.Title, Title: input.Title,
Content: input.Content, Content: input.Content,
OwnerID: input.OwnerID, ApproverID: input.ApproverID,
Classification: input.Classification, Classification: input.Classification,
DocumentType: input.DocumentType, DocumentType: input.DocumentType,
TrustCenterVisibility: trustCenterVisibility, TrustCenterVisibility: trustCenterVisibility,
@@ -1615,7 +1615,7 @@ func (r *Resolver) UpdateDocumentTool(ctx context.Context, req *mcp.CallToolRequ
probo.UpdateDocumentRequest{ probo.UpdateDocumentRequest{
DocumentID: input.ID, DocumentID: input.ID,
Title: input.Title, Title: input.Title,
OwnerID: input.OwnerID, ApproverID: input.ApproverID,
Classification: input.Classification, Classification: input.Classification,
DocumentType: input.DocumentType, DocumentType: input.DocumentType,
TrustCenterVisibility: input.TrustCenterVisibility, TrustCenterVisibility: input.TrustCenterVisibility,

View File

@@ -23,7 +23,7 @@ func NewDocument(d *coredata.Document) *Document {
return &Document{ return &Document{
ID: d.ID, ID: d.ID,
OrganizationID: d.OrganizationID, OrganizationID: d.OrganizationID,
OwnerID: d.OwnerID, ApproverID: d.ApproverID,
Title: d.Title, Title: d.Title,
DocumentType: d.DocumentType, DocumentType: d.DocumentType,
Classification: d.Classification, Classification: d.Classification,
@@ -65,7 +65,7 @@ func NewDocumentVersion(dv *coredata.DocumentVersion) *DocumentVersion {
OrganizationID: dv.OrganizationID, OrganizationID: dv.OrganizationID,
DocumentID: dv.DocumentID, DocumentID: dv.DocumentID,
Title: dv.Title, Title: dv.Title,
OwnerID: dv.OwnerID, ApproverID: dv.ApproverID,
VersionNumber: dv.VersionNumber, VersionNumber: dv.VersionNumber,
Classification: dv.Classification, Classification: dv.Classification,
Content: dv.Content, Content: dv.Content,

View File

@@ -25,8 +25,8 @@ var (
AddControlToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"control":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"description":{"description":"Control description"},"exclusion_justification":{"description":"Exclusion justification"},"framework_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Control name"},"organization_id":{"type":"string","format":"string"},"section_title":{"type":"string","description":"Section title"},"status":{"type":"string","enum":["INCLUDED","EXCLUDED"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","framework_id","section_title","name","status","created_at","updated_at"]}},"required":["control"]}`) AddControlToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"control":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"description":{"description":"Control description"},"exclusion_justification":{"description":"Exclusion justification"},"framework_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Control name"},"organization_id":{"type":"string","format":"string"},"section_title":{"type":"string","description":"Section title"},"status":{"type":"string","enum":["INCLUDED","EXCLUDED"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","framework_id","section_title","name","status","created_at","updated_at"]}},"required":["control"]}`)
AddDatumToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"name":{"type":"string","description":"Datum name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"vendor_ids":{"type":"array","items":{"type":"string","format":"string"},"description":"Vendor IDs"}},"required":["organization_id","name","data_classification","owner_id"]}`) AddDatumToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"name":{"type":"string","description":"Datum name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"vendor_ids":{"type":"array","items":{"type":"string","format":"string"},"description":"Vendor IDs"}},"required":["organization_id","name","data_classification","owner_id"]}`)
AddDatumToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"datum":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Datum name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"snapshot_id":{"description":"Snapshot ID","anyOf":[{"type":"string","format":"string"},{"type":"null","description":"No snapshot"}]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","data_classification","owner_id","created_at","updated_at"]}},"required":["datum"]}`) AddDatumToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"datum":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Datum name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"snapshot_id":{"description":"Snapshot ID","anyOf":[{"type":"string","format":"string"},{"type":"null","description":"No snapshot"}]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","data_classification","owner_id","created_at","updated_at"]}},"required":["datum"]}`)
AddDocumentToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]}},"required":["organization_id","title","content","owner_id","classification","document_type"]}`) AddDocumentToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]}},"required":["organization_id","title","content","approver_id","classification","document_type"]}`)
AddDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","owner_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]},"document_version":{"type":"object","properties":{"changelog":{"type":"string","description":"Changelog"},"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"published_at":{"description":"Published timestamp","format":"date-time"},"status":{"type":"string","enum":["DRAFT","PUBLISHED"]},"title":{"type":"string","description":"Document version title"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"},"version_number":{"type":"integer","description":"Version number"}},"required":["id","organization_id","document_id","title","owner_id","version_number","classification","content","changelog","status","created_at","updated_at"]}},"required":["document","document_version"]}`) AddDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","approver_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]},"document_version":{"type":"object","properties":{"changelog":{"type":"string","description":"Changelog"},"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"published_at":{"description":"Published timestamp","format":"date-time"},"status":{"type":"string","enum":["DRAFT","PUBLISHED"]},"title":{"type":"string","description":"Document version title"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"},"version_number":{"type":"integer","description":"Version number"}},"required":["id","organization_id","document_id","title","approver_id","version_number","classification","content","changelog","status","created_at","updated_at"]}},"required":["document","document_version"]}`)
AddFrameworkToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"description":{"type":"string","description":"Framework description"},"name":{"type":"string","description":"Framework name"},"organization_id":{"type":"string","format":"string"}},"required":["organization_id","name"]}`) AddFrameworkToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"description":{"type":"string","description":"Framework description"},"name":{"type":"string","description":"Framework name"},"organization_id":{"type":"string","format":"string"}},"required":["organization_id","name"]}`)
AddFrameworkToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"framework":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"description":{"description":"Framework description"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Framework name"},"organization_id":{"type":"string","format":"string"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","created_at","updated_at"]}},"required":["framework"]}`) AddFrameworkToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"framework":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"description":{"description":"Framework description"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Framework name"},"organization_id":{"type":"string","format":"string"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","created_at","updated_at"]}},"required":["framework"]}`)
AddMeasureToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"category":{"type":"string","description":"Measure category"},"description":{"type":"string","description":"Measure description"},"name":{"type":"string","description":"Measure name"},"organization_id":{"type":"string","format":"string"}},"required":["organization_id","name","category"]}`) AddMeasureToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"category":{"type":"string","description":"Measure category"},"description":{"type":"string","description":"Measure description"},"name":{"type":"string","description":"Measure name"},"organization_id":{"type":"string","format":"string"}},"required":["organization_id","name","category"]}`)
@@ -70,7 +70,7 @@ var (
GetDatumToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`) GetDatumToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
GetDatumToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"datum":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Datum name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"snapshot_id":{"description":"Snapshot ID","anyOf":[{"type":"string","format":"string"},{"type":"null","description":"No snapshot"}]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","data_classification","owner_id","created_at","updated_at"]}},"required":["datum"]}`) GetDatumToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"datum":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Datum name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"snapshot_id":{"description":"Snapshot ID","anyOf":[{"type":"string","format":"string"},{"type":"null","description":"No snapshot"}]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","data_classification","owner_id","created_at","updated_at"]}},"required":["datum"]}`)
GetDocumentToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`) GetDocumentToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
GetDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","owner_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]}},"required":["document"]}`) GetDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","approver_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]}},"required":["document"]}`)
GetDocumentVersionSignatureToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`) GetDocumentVersionSignatureToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
GetDocumentVersionSignatureToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_version_signature":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_version_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"requested_at":{"type":"string","description":"Requested timestamp","format":"date-time"},"signed_at":{"description":"Signed timestamp","format":"date-time"},"signed_by":{"type":"string","format":"string"},"state":{"type":"string","enum":["REQUESTED","SIGNED"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","document_version_id","state","signed_by","requested_at","created_at","updated_at"]}},"required":["document_version_signature"]}`) GetDocumentVersionSignatureToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_version_signature":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_version_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"requested_at":{"type":"string","description":"Requested timestamp","format":"date-time"},"signed_at":{"description":"Signed timestamp","format":"date-time"},"signed_by":{"type":"string","format":"string"},"state":{"type":"string","enum":["REQUESTED","SIGNED"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","document_version_id","state","signed_by","requested_at","created_at","updated_at"]}},"required":["document_version_signature"]}`)
GetDocumentVersionToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`) GetDocumentVersionToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"id":{"type":"string","format":"string"}},"required":["id"]}`)
@@ -114,9 +114,9 @@ var (
ListDocumentVersionSignaturesToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"document_version_id":{"type":"string","format":"string"},"filter":{"type":"object","properties":{"active_contract":{"type":"boolean","description":"Signatory contract status"},"states":{"type":"array","items":{"type":"string","enum":["REQUESTED","SIGNED"]},"description":"Signature states"}}},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT","SIGNED_AT"]}},"required":["field","direction"]},"size":{"type":"integer","description":"Page size"}},"required":["document_version_id"]}`) ListDocumentVersionSignaturesToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"document_version_id":{"type":"string","format":"string"},"filter":{"type":"object","properties":{"active_contract":{"type":"boolean","description":"Signatory contract status"},"states":{"type":"array","items":{"type":"string","enum":["REQUESTED","SIGNED"]},"description":"Signature states"}}},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT","SIGNED_AT"]}},"required":["field","direction"]},"size":{"type":"integer","description":"Page size"}},"required":["document_version_id"]}`)
ListDocumentVersionSignaturesToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_version_signatures":{"type":"array","items":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_version_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"requested_at":{"type":"string","description":"Requested timestamp","format":"date-time"},"signed_at":{"description":"Signed timestamp","format":"date-time"},"signed_by":{"type":"string","format":"string"},"state":{"type":"string","enum":["REQUESTED","SIGNED"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","document_version_id","state","signed_by","requested_at","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["document_version_signatures"]}`) ListDocumentVersionSignaturesToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_version_signatures":{"type":"array","items":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_version_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"requested_at":{"type":"string","description":"Requested timestamp","format":"date-time"},"signed_at":{"description":"Signed timestamp","format":"date-time"},"signed_by":{"type":"string","format":"string"},"state":{"type":"string","enum":["REQUESTED","SIGNED"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","document_version_id","state","signed_by","requested_at","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["document_version_signatures"]}`)
ListDocumentVersionsToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"document_id":{"type":"string","format":"string"},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT","VERSION"]}},"required":["field","direction"]},"size":{"type":"integer","description":"Page size"}},"required":["document_id"]}`) ListDocumentVersionsToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"document_id":{"type":"string","format":"string"},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT","VERSION"]}},"required":["field","direction"]},"size":{"type":"integer","description":"Page size"}},"required":["document_id"]}`)
ListDocumentVersionsToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_versions":{"type":"array","items":{"type":"object","properties":{"changelog":{"type":"string","description":"Changelog"},"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"published_at":{"description":"Published timestamp","format":"date-time"},"status":{"type":"string","enum":["DRAFT","PUBLISHED"]},"title":{"type":"string","description":"Document version title"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"},"version_number":{"type":"integer","description":"Version number"}},"required":["id","organization_id","document_id","title","owner_id","version_number","classification","content","changelog","status","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["document_versions"]}`) ListDocumentVersionsToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_versions":{"type":"array","items":{"type":"object","properties":{"changelog":{"type":"string","description":"Changelog"},"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"published_at":{"description":"Published timestamp","format":"date-time"},"status":{"type":"string","enum":["DRAFT","PUBLISHED"]},"title":{"type":"string","description":"Document version title"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"},"version_number":{"type":"integer","description":"Version number"}},"required":["id","organization_id","document_id","title","approver_id","version_number","classification","content","changelog","status","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["document_versions"]}`)
ListDocumentsToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"filter":{"type":"object","properties":{"query":{"type":"string","description":"Search query"},"trust_center_visibilities":{"type":"array","items":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"description":"Trust center visibilities"}}},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT","TITLE","DOCUMENT_TYPE"]}},"required":["field","direction"]},"organization_id":{"type":"string","format":"string"},"size":{"type":"integer","description":"Page size"}},"required":["organization_id"]}`) ListDocumentsToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"filter":{"type":"object","properties":{"query":{"type":"string","description":"Search query"},"trust_center_visibilities":{"type":"array","items":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"description":"Trust center visibilities"}}},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT","TITLE","DOCUMENT_TYPE"]}},"required":["field","direction"]},"organization_id":{"type":"string","format":"string"},"size":{"type":"integer","description":"Page size"}},"required":["organization_id"]}`)
ListDocumentsToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"documents":{"type":"array","items":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","owner_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["documents"]}`) ListDocumentsToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"documents":{"type":"array","items":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","approver_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["documents"]}`)
ListFrameworksToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT"]}},"required":["field","direction"]},"organization_id":{"type":"string","format":"string"},"size":{"type":"integer","description":"Page size"}},"required":["organization_id"]}`) ListFrameworksToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT"]}},"required":["field","direction"]},"organization_id":{"type":"string","format":"string"},"size":{"type":"integer","description":"Page size"}},"required":["organization_id"]}`)
ListFrameworksToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"frameworks":{"type":"array","items":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"description":{"description":"Framework description"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Framework name"},"organization_id":{"type":"string","format":"string"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["frameworks"]}`) ListFrameworksToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"frameworks":{"type":"array","items":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"description":{"description":"Framework description"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Framework name"},"organization_id":{"type":"string","format":"string"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","created_at","updated_at"]}},"next_cursor":{"type":"string","format":"string"}},"required":["frameworks"]}`)
ListMeasuresToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"filter":{"type":"object","properties":{"query":{"type":"string","description":"Search query"},"state":{"type":"string","enum":["NOT_STARTED","IN_PROGRESS","NOT_APPLICABLE","IMPLEMENTED"]}}},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT","NAME"]}},"required":["field","direction"]},"organization_id":{"type":"string","format":"string"},"size":{"type":"integer","description":"Page size"}},"required":["organization_id"]}`) ListMeasuresToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"cursor":{"type":"string","format":"string"},"filter":{"type":"object","properties":{"query":{"type":"string","description":"Search query"},"state":{"type":"string","enum":["NOT_STARTED","IN_PROGRESS","NOT_APPLICABLE","IMPLEMENTED"]}}},"order_by":{"type":"object","properties":{"direction":{"type":"string","enum":["ASC","DESC"]},"field":{"type":"string","enum":["CREATED_AT","NAME"]}},"required":["field","direction"]},"organization_id":{"type":"string","format":"string"},"size":{"type":"integer","description":"Page size"}},"required":["organization_id"]}`)
@@ -167,8 +167,8 @@ var (
UpdateControlToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"control":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"description":{"description":"Control description"},"exclusion_justification":{"description":"Exclusion justification"},"framework_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Control name"},"organization_id":{"type":"string","format":"string"},"section_title":{"type":"string","description":"Section title"},"status":{"type":"string","enum":["INCLUDED","EXCLUDED"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","framework_id","section_title","name","status","created_at","updated_at"]}},"required":["control"]}`) UpdateControlToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"control":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"description":{"description":"Control description"},"exclusion_justification":{"description":"Exclusion justification"},"framework_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Control name"},"organization_id":{"type":"string","format":"string"},"section_title":{"type":"string","description":"Section title"},"status":{"type":"string","enum":["INCLUDED","EXCLUDED"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","framework_id","section_title","name","status","created_at","updated_at"]}},"required":["control"]}`)
UpdateDatumToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Datum name"},"owner_id":{"description":"Owner ID","anyOf":[{"type":"string","format":"string"},{"type":"null"}]},"vendor_ids":{"type":"array","items":{"type":"string","format":"string"},"description":"Vendor IDs"}},"required":["id"]}`) UpdateDatumToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Datum name"},"owner_id":{"description":"Owner ID","anyOf":[{"type":"string","format":"string"},{"type":"null"}]},"vendor_ids":{"type":"array","items":{"type":"string","format":"string"},"description":"Vendor IDs"}},"required":["id"]}`)
UpdateDatumToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"datum":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Datum name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"snapshot_id":{"description":"Snapshot ID","anyOf":[{"type":"string","format":"string"},{"type":"null","description":"No snapshot"}]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","data_classification","owner_id","created_at","updated_at"]}},"required":["datum"]}`) UpdateDatumToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"datum":{"type":"object","properties":{"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"data_classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Datum name"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"snapshot_id":{"description":"Snapshot ID","anyOf":[{"type":"string","format":"string"},{"type":"null","description":"No snapshot"}]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","name","data_classification","owner_id","created_at","updated_at"]}},"required":["datum"]}`)
UpdateDocumentToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]}},"required":["id"]}`) UpdateDocumentToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]}},"required":["id"]}`)
UpdateDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","owner_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]}},"required":["document"]}`) UpdateDocumentToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document":{"type":"object","properties":{"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"current_published_version":{"description":"Current published version number"},"document_type":{"type":"string","enum":["OTHER","ISMS","POLICY","PROCEDURE"]},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"approver_id":{"type":"string","format":"string"},"title":{"type":"string","description":"Document title"},"trust_center_visibility":{"type":"string","enum":["NONE","PRIVATE","PUBLIC"]},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"}},"required":["id","organization_id","approver_id","title","document_type","classification","trust_center_visibility","created_at","updated_at"]}},"required":["document"]}`)
UpdateDocumentVersionToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"content":{"type":"string","description":"Document content"},"document_version_id":{"type":"string","format":"string"}},"required":["document_version_id","content"]}`) UpdateDocumentVersionToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"content":{"type":"string","description":"Document content"},"document_version_id":{"type":"string","format":"string"}},"required":["document_version_id","content"]}`)
UpdateDocumentVersionToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_version":{"type":"object","properties":{"changelog":{"type":"string","description":"Changelog"},"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"published_at":{"description":"Published timestamp","format":"date-time"},"status":{"type":"string","enum":["DRAFT","PUBLISHED"]},"title":{"type":"string","description":"Document version title"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"},"version_number":{"type":"integer","description":"Version number"}},"required":["id","organization_id","document_id","title","owner_id","version_number","classification","content","changelog","status","created_at","updated_at"]}},"required":["document_version"]}`) UpdateDocumentVersionToolOutputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"document_version":{"type":"object","properties":{"changelog":{"type":"string","description":"Changelog"},"classification":{"type":"string","enum":["PUBLIC","INTERNAL","CONFIDENTIAL","SECRET"]},"content":{"type":"string","description":"Document content"},"created_at":{"type":"string","description":"Creation timestamp","format":"date-time"},"document_id":{"type":"string","format":"string"},"id":{"type":"string","format":"string"},"organization_id":{"type":"string","format":"string"},"owner_id":{"type":"string","format":"string"},"published_at":{"description":"Published timestamp","format":"date-time"},"status":{"type":"string","enum":["DRAFT","PUBLISHED"]},"title":{"type":"string","description":"Document version title"},"updated_at":{"type":"string","description":"Update timestamp","format":"date-time"},"version_number":{"type":"integer","description":"Version number"}},"required":["id","organization_id","document_id","title","owner_id","version_number","classification","content","changelog","status","created_at","updated_at"]}},"required":["document_version"]}`)
UpdateFrameworkToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"description":{"description":"Framework description"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Framework name"}},"required":["id"]}`) UpdateFrameworkToolInputSchema = mcp.MustUnmarshalSchema(`{"type":"object","properties":{"description":{"description":"Framework description"},"id":{"type":"string","format":"string"},"name":{"type":"string","description":"Framework name"}},"required":["id"]}`)
@@ -612,8 +612,8 @@ type AddDocumentInput struct {
DocumentType coredata.DocumentType `json:"document_type"` DocumentType coredata.DocumentType `json:"document_type"`
// Organization ID // Organization ID
OrganizationID gid.GID `json:"organization_id"` OrganizationID gid.GID `json:"organization_id"`
// Owner ID // Approver ID
OwnerID gid.GID `json:"owner_id"` ApproverID gid.GID `json:"approver_id"`
// Document title // Document title
Title string `json:"title"` Title string `json:"title"`
// Trust center visibility // Trust center visibility
@@ -1102,8 +1102,8 @@ type Document struct {
ID gid.GID `json:"id"` ID gid.GID `json:"id"`
// Organization ID // Organization ID
OrganizationID gid.GID `json:"organization_id"` OrganizationID gid.GID `json:"organization_id"`
// Owner ID // Approver ID
OwnerID gid.GID `json:"owner_id"` ApproverID gid.GID `json:"approver_id"`
// Document title // Document title
Title string `json:"title"` Title string `json:"title"`
// Trust center visibility // Trust center visibility
@@ -1136,8 +1136,8 @@ type DocumentVersion struct {
ID gid.GID `json:"id"` ID gid.GID `json:"id"`
// Organization ID // Organization ID
OrganizationID gid.GID `json:"organization_id"` OrganizationID gid.GID `json:"organization_id"`
// Owner ID // Approver ID
OwnerID gid.GID `json:"owner_id"` ApproverID gid.GID `json:"approver_id"`
// Published timestamp // Published timestamp
PublishedAt *time.Time `json:"published_at,omitempty"` PublishedAt *time.Time `json:"published_at,omitempty"`
// Document status // Document status
@@ -2348,8 +2348,8 @@ type UpdateDocumentInput struct {
DocumentType *coredata.DocumentType `json:"document_type,omitempty"` DocumentType *coredata.DocumentType `json:"document_type,omitempty"`
// Document ID // Document ID
ID gid.GID `json:"id"` ID gid.GID `json:"id"`
// Owner ID // Approver ID
OwnerID *gid.GID `json:"owner_id,omitempty"` ApproverID *gid.GID `json:"approver_id,omitempty"`
// Document title // Document title
Title *string `json:"title,omitempty"` Title *string `json:"title,omitempty"`
// Trust center visibility // Trust center visibility

View File

@@ -142,7 +142,7 @@ func (s *DocumentService) exportPDFData(
) ([]byte, error) { ) ([]byte, error) {
document := &coredata.Document{} document := &coredata.Document{}
version := &coredata.DocumentVersion{} version := &coredata.DocumentVersion{}
owner := &coredata.MembershipProfile{} approver := &coredata.MembershipProfile{}
organization := &coredata.Organization{} organization := &coredata.Organization{}
err := s.svc.pg.WithConn( err := s.svc.pg.WithConn(
@@ -160,8 +160,8 @@ func (s *DocumentService) exportPDFData(
return fmt.Errorf("cannot load latest published document version: %w", err) return fmt.Errorf("cannot load latest published document version: %w", err)
} }
if err := owner.LoadByID(ctx, conn, s.svc.scope, document.OwnerID); err != nil { if err := approver.LoadByID(ctx, conn, s.svc.scope, document.ApproverID); err != nil {
return fmt.Errorf("cannot load document owner profile: %w", err) return fmt.Errorf("cannot load document approver profile: %w", err)
} }
if err := organization.LoadByID(ctx, conn, s.svc.scope, document.OrganizationID); err != nil { if err := organization.LoadByID(ctx, conn, s.svc.scope, document.OrganizationID); err != nil {
@@ -203,7 +203,7 @@ func (s *DocumentService) exportPDFData(
Content: version.Content, Content: version.Content,
Version: version.VersionNumber, Version: version.VersionNumber,
Classification: classification, Classification: classification,
Approver: owner.FullName, Approver: approver.FullName,
PublishedAt: version.PublishedAt, PublishedAt: version.PublishedAt,
CompanyHorizontalLogoBase64: horizontalLogoBase64, CompanyHorizontalLogoBase64: horizontalLogoBase64,
} }