Fix signatures count on documents page

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-01-27 16:11:10 +04:00
parent 147ea0f08f
commit 165b2e7a67
7 changed files with 305 additions and 241 deletions

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<766e48d090179d20cc6a7b1d6bc6591f>> * @generated SignedSource<<40817b8ba263ba9d0140a57e41e6ca44>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -65,7 +65,21 @@ v3 = {
"kind": "ScalarField", "kind": "ScalarField",
"name": "id", "name": "id",
"storageKey": null "storageKey": null
}; },
v4 = {
"kind": "Literal",
"name": "first",
"value": 0
},
v5 = [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "totalCount",
"storageKey": null
}
];
return { return {
"fragment": { "fragment": {
"argumentDefinitions": [ "argumentDefinitions": [
@@ -214,12 +228,20 @@ return {
"storageKey": null "storageKey": null
}, },
{ {
"alias": null, "alias": "lastVersion",
"args": [ "args": [
{ {
"kind": "Literal", "kind": "Literal",
"name": "first", "name": "first",
"value": 1 "value": 1
},
{
"kind": "Literal",
"name": "orderBy",
"value": {
"direction": "DESC",
"field": "CREATED_AT"
}
} }
], ],
"concreteType": "DocumentVersionConnection", "concreteType": "DocumentVersionConnection",
@@ -263,38 +285,41 @@ return {
"args": [ "args": [
{ {
"kind": "Literal", "kind": "Literal",
"name": "first", "name": "filter",
"value": 1000 "value": {
"activeContract": true
} }
},
(v4/*: any*/)
], ],
"concreteType": "DocumentVersionSignatureConnection", "concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "signatures", "name": "signatures",
"plural": false, "plural": false,
"selections": [ "selections": (v5/*: any*/),
"storageKey": "signatures(filter:{\"activeContract\":true},first:0)"
},
{ {
"alias": null, "alias": "signedSignatures",
"args": null, "args": [
"concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
"selections": [
{ {
"alias": null, "kind": "Literal",
"args": null, "name": "filter",
"concreteType": "DocumentVersionSignature", "value": {
"activeContract": true,
"states": [
"SIGNED"
]
}
},
(v4/*: any*/)
],
"concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "signatures",
"plural": false, "plural": false,
"selections": [ "selections": (v5/*: any*/),
(v3/*: any*/), "storageKey": "signatures(filter:{\"activeContract\":true,\"states\":[\"SIGNED\"]},first:0)"
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "state",
"storageKey": null
} }
], ],
"storageKey": null "storageKey": null
@@ -303,16 +328,7 @@ return {
"storageKey": null "storageKey": null
} }
], ],
"storageKey": "signatures(first:1000)" "storageKey": "versions(first:1,orderBy:{\"direction\":\"DESC\",\"field\":\"CREATED_AT\"})"
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": "versions(first:1)"
} }
], ],
"storageKey": null "storageKey": null
@@ -342,12 +358,12 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "20ca0b6c942e66b92ced0b4869262530", "cacheID": "089c02e59ef9b51883dd556df68891b9",
"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 versions(first: 1) {\n edges {\n node {\n id\n status\n version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n }\n }\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 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"
} }
}; };
})(); })();

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<664a9b09aac444c69891219cca1c6b8d>> * @generated SignedSource<<b6234102a57c0c233979c0bc51c2b49c>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -12,36 +12,33 @@ import { ReaderFragment } from 'relay-runtime';
export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET"; export type DocumentClassification = "CONFIDENTIAL" | "INTERNAL" | "PUBLIC" | "SECRET";
export type DocumentStatus = "DRAFT" | "PUBLISHED"; export type DocumentStatus = "DRAFT" | "PUBLISHED";
export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE"; export type DocumentType = "ISMS" | "OTHER" | "POLICY" | "PROCEDURE";
export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED";
import { FragmentRefs } from "relay-runtime"; import { FragmentRefs } from "relay-runtime";
export type DocumentListItemFragment$data = { export type DocumentListItemFragment$data = {
readonly canDelete: boolean; readonly canDelete: boolean;
readonly classification: DocumentClassification; readonly classification: DocumentClassification;
readonly documentType: DocumentType; readonly documentType: DocumentType;
readonly id: string; readonly id: string;
readonly owner: { readonly lastVersion: {
readonly fullName: string;
readonly id: string;
};
readonly title: string;
readonly updatedAt: string;
readonly versions: {
readonly edges: ReadonlyArray<{ readonly edges: ReadonlyArray<{
readonly node: { readonly node: {
readonly id: string; readonly id: string;
readonly signatures: { readonly signatures: {
readonly edges: ReadonlyArray<{ readonly totalCount: number;
readonly node: {
readonly id: string;
readonly state: DocumentVersionSignatureState;
}; };
}>; readonly signedSignatures: {
readonly totalCount: number;
}; };
readonly status: DocumentStatus; readonly status: DocumentStatus;
readonly version: number; readonly version: number;
}; };
}>; }>;
}; };
readonly owner: {
readonly fullName: string;
readonly id: string;
};
readonly title: string;
readonly updatedAt: string;
readonly " $fragmentType": "DocumentListItemFragment"; readonly " $fragmentType": "DocumentListItemFragment";
}; };
export type DocumentListItemFragment$key = { export type DocumentListItemFragment$key = {
@@ -56,7 +53,21 @@ var v0 = {
"kind": "ScalarField", "kind": "ScalarField",
"name": "id", "name": "id",
"storageKey": null "storageKey": null
}; },
v1 = {
"kind": "Literal",
"name": "first",
"value": 0
},
v2 = [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "totalCount",
"storageKey": null
}
];
return { return {
"argumentDefinitions": [], "argumentDefinitions": [],
"kind": "Fragment", "kind": "Fragment",
@@ -125,12 +136,20 @@ return {
"storageKey": null "storageKey": null
}, },
{ {
"alias": null, "alias": "lastVersion",
"args": [ "args": [
{ {
"kind": "Literal", "kind": "Literal",
"name": "first", "name": "first",
"value": 1 "value": 1
},
{
"kind": "Literal",
"name": "orderBy",
"value": {
"direction": "DESC",
"field": "CREATED_AT"
}
} }
], ],
"concreteType": "DocumentVersionConnection", "concreteType": "DocumentVersionConnection",
@@ -174,38 +193,41 @@ return {
"args": [ "args": [
{ {
"kind": "Literal", "kind": "Literal",
"name": "first", "name": "filter",
"value": 1000 "value": {
"activeContract": true
} }
},
(v1/*: any*/)
], ],
"concreteType": "DocumentVersionSignatureConnection", "concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "signatures", "name": "signatures",
"plural": false, "plural": false,
"selections": [ "selections": (v2/*: any*/),
"storageKey": "signatures(filter:{\"activeContract\":true},first:0)"
},
{ {
"alias": null, "alias": "signedSignatures",
"args": null, "args": [
"concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
"selections": [
{ {
"alias": null, "kind": "Literal",
"args": null, "name": "filter",
"concreteType": "DocumentVersionSignature", "value": {
"activeContract": true,
"states": [
"SIGNED"
]
}
},
(v1/*: any*/)
],
"concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "signatures",
"plural": false, "plural": false,
"selections": [ "selections": (v2/*: any*/),
(v0/*: any*/), "storageKey": "signatures(filter:{\"activeContract\":true,\"states\":[\"SIGNED\"]},first:0)"
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "state",
"storageKey": null
} }
], ],
"storageKey": null "storageKey": null
@@ -214,16 +236,7 @@ return {
"storageKey": null "storageKey": null
} }
], ],
"storageKey": "signatures(first:1000)" "storageKey": "versions(first:1,orderBy:{\"direction\":\"DESC\",\"field\":\"CREATED_AT\"})"
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": "versions(first:1)"
} }
], ],
"type": "Document", "type": "Document",
@@ -231,6 +244,6 @@ return {
}; };
})(); })();
(node as any).hash = "6c4db808e4ec47dbca635feb3ea13e56"; (node as any).hash = "6e72b37fa90b7a272ebba38fe80b9f93";
export default node; export default node;

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<f3ca69e3f5731e73dc9f4268b0507adc>> * @generated SignedSource<<582e2fb7616b46350bf9dbce26c62811>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -119,6 +119,20 @@ v13 = [
"name": "orderBy", "name": "orderBy",
"variableName": "order" "variableName": "order"
} }
],
v14 = {
"kind": "Literal",
"name": "first",
"value": 0
},
v15 = [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "totalCount",
"storageKey": null
}
]; ];
return { return {
"fragment": { "fragment": {
@@ -302,12 +316,20 @@ return {
"storageKey": null "storageKey": null
}, },
{ {
"alias": null, "alias": "lastVersion",
"args": [ "args": [
{ {
"kind": "Literal", "kind": "Literal",
"name": "first", "name": "first",
"value": 1 "value": 1
},
{
"kind": "Literal",
"name": "orderBy",
"value": {
"direction": "DESC",
"field": "CREATED_AT"
}
} }
], ],
"concreteType": "DocumentVersionConnection", "concreteType": "DocumentVersionConnection",
@@ -351,38 +373,41 @@ return {
"args": [ "args": [
{ {
"kind": "Literal", "kind": "Literal",
"name": "first", "name": "filter",
"value": 1000 "value": {
"activeContract": true
} }
},
(v14/*: any*/)
], ],
"concreteType": "DocumentVersionSignatureConnection", "concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "signatures", "name": "signatures",
"plural": false, "plural": false,
"selections": [ "selections": (v15/*: any*/),
"storageKey": "signatures(filter:{\"activeContract\":true},first:0)"
},
{ {
"alias": null, "alias": "signedSignatures",
"args": null, "args": [
"concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
"selections": [
{ {
"alias": null, "kind": "Literal",
"args": null, "name": "filter",
"concreteType": "DocumentVersionSignature", "value": {
"activeContract": true,
"states": [
"SIGNED"
]
}
},
(v14/*: any*/)
],
"concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "signatures",
"plural": false, "plural": false,
"selections": [ "selections": (v15/*: any*/),
(v12/*: any*/), "storageKey": "signatures(filter:{\"activeContract\":true,\"states\":[\"SIGNED\"]},first:0)"
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "state",
"storageKey": null
} }
], ],
"storageKey": null "storageKey": null
@@ -391,16 +416,7 @@ return {
"storageKey": null "storageKey": null
} }
], ],
"storageKey": "signatures(first:1000)" "storageKey": "versions(first:1,orderBy:{\"direction\":\"DESC\",\"field\":\"CREATED_AT\"})"
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": "versions(first:1)"
}, },
(v11/*: any*/) (v11/*: any*/)
], ],
@@ -491,12 +507,12 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "c404cb30a5176c7d01cace940923f480", "cacheID": "d79ffc90943fa44e309a27784a8c65b8",
"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 versions(first: 1) {\n edges {\n node {\n id\n status\n version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n }\n }\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 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"
} }
}; };
})(); })();

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<fc98d690c8825d5c202355ffd63a4244>> * @generated SignedSource<<df4a916b5ff0623fb9be5ac5b4651fac>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -107,7 +107,21 @@ v8 = {
"kind": "ScalarField", "kind": "ScalarField",
"name": "id", "name": "id",
"storageKey": null "storageKey": null
}; },
v9 = {
"kind": "Literal",
"name": "first",
"value": 0
},
v10 = [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "totalCount",
"storageKey": null
}
];
return { return {
"fragment": { "fragment": {
"argumentDefinitions": (v0/*: any*/), "argumentDefinitions": (v0/*: any*/),
@@ -317,12 +331,20 @@ return {
"storageKey": null "storageKey": null
}, },
{ {
"alias": null, "alias": "lastVersion",
"args": [ "args": [
{ {
"kind": "Literal", "kind": "Literal",
"name": "first", "name": "first",
"value": 1 "value": 1
},
{
"kind": "Literal",
"name": "orderBy",
"value": {
"direction": "DESC",
"field": "CREATED_AT"
}
} }
], ],
"concreteType": "DocumentVersionConnection", "concreteType": "DocumentVersionConnection",
@@ -366,38 +388,41 @@ return {
"args": [ "args": [
{ {
"kind": "Literal", "kind": "Literal",
"name": "first", "name": "filter",
"value": 1000 "value": {
"activeContract": true
} }
},
(v9/*: any*/)
], ],
"concreteType": "DocumentVersionSignatureConnection", "concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "signatures", "name": "signatures",
"plural": false, "plural": false,
"selections": [ "selections": (v10/*: any*/),
"storageKey": "signatures(filter:{\"activeContract\":true},first:0)"
},
{ {
"alias": null, "alias": "signedSignatures",
"args": null, "args": [
"concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
"selections": [
{ {
"alias": null, "kind": "Literal",
"args": null, "name": "filter",
"concreteType": "DocumentVersionSignature", "value": {
"activeContract": true,
"states": [
"SIGNED"
]
}
},
(v9/*: any*/)
],
"concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "signatures",
"plural": false, "plural": false,
"selections": [ "selections": (v10/*: any*/),
(v8/*: any*/), "storageKey": "signatures(filter:{\"activeContract\":true,\"states\":[\"SIGNED\"]},first:0)"
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "state",
"storageKey": null
} }
], ],
"storageKey": null "storageKey": null
@@ -406,16 +431,7 @@ return {
"storageKey": null "storageKey": null
} }
], ],
"storageKey": "signatures(first:1000)" "storageKey": "versions(first:1,orderBy:{\"direction\":\"DESC\",\"field\":\"CREATED_AT\"})"
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": "versions(first:1)"
}, },
(v2/*: any*/), (v2/*: any*/),
(v7/*: any*/) (v7/*: any*/)
@@ -507,12 +523,12 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "2ff9e1818d86d64d512a54ec9acebb16", "cacheID": "be5d2e7f4a87fba4bf56e605bd849d7d",
"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 versions(first: 1) {\n edges {\n node {\n id\n status\n version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n }\n }\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 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"
} }
}; };
})(); })();

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<3fb1661c5bda6573c377f516b970643a>> * @generated SignedSource<<96fbfd51b05b496753a0d278d92f2eb4>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -53,7 +53,21 @@ v2 = {
"kind": "ScalarField", "kind": "ScalarField",
"name": "id", "name": "id",
"storageKey": null "storageKey": null
}; },
v3 = {
"kind": "Literal",
"name": "first",
"value": 0
},
v4 = [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "totalCount",
"storageKey": null
}
];
return { return {
"fragment": { "fragment": {
"argumentDefinitions": (v0/*: any*/), "argumentDefinitions": (v0/*: any*/),
@@ -196,12 +210,20 @@ return {
"storageKey": null "storageKey": null
}, },
{ {
"alias": null, "alias": "lastVersion",
"args": [ "args": [
{ {
"kind": "Literal", "kind": "Literal",
"name": "first", "name": "first",
"value": 1 "value": 1
},
{
"kind": "Literal",
"name": "orderBy",
"value": {
"direction": "DESC",
"field": "CREATED_AT"
}
} }
], ],
"concreteType": "DocumentVersionConnection", "concreteType": "DocumentVersionConnection",
@@ -245,38 +267,41 @@ return {
"args": [ "args": [
{ {
"kind": "Literal", "kind": "Literal",
"name": "first", "name": "filter",
"value": 1000 "value": {
"activeContract": true
} }
},
(v3/*: any*/)
], ],
"concreteType": "DocumentVersionSignatureConnection", "concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "signatures", "name": "signatures",
"plural": false, "plural": false,
"selections": [ "selections": (v4/*: any*/),
"storageKey": "signatures(filter:{\"activeContract\":true},first:0)"
},
{ {
"alias": null, "alias": "signedSignatures",
"args": null, "args": [
"concreteType": "DocumentVersionSignatureEdge",
"kind": "LinkedField",
"name": "edges",
"plural": true,
"selections": [
{ {
"alias": null, "kind": "Literal",
"args": null, "name": "filter",
"concreteType": "DocumentVersionSignature", "value": {
"activeContract": true,
"states": [
"SIGNED"
]
}
},
(v3/*: any*/)
],
"concreteType": "DocumentVersionSignatureConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "node", "name": "signatures",
"plural": false, "plural": false,
"selections": [ "selections": (v4/*: any*/),
(v2/*: any*/), "storageKey": "signatures(filter:{\"activeContract\":true,\"states\":[\"SIGNED\"]},first:0)"
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "state",
"storageKey": null
} }
], ],
"storageKey": null "storageKey": null
@@ -285,16 +310,7 @@ return {
"storageKey": null "storageKey": null
} }
], ],
"storageKey": "signatures(first:1000)" "storageKey": "versions(first:1,orderBy:{\"direction\":\"DESC\",\"field\":\"CREATED_AT\"})"
}
],
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": "versions(first:1)"
} }
], ],
"storageKey": null "storageKey": null
@@ -308,12 +324,12 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "9e790eaab9b8c776beb9d021942bdf22", "cacheID": "0ac164af501f3f1bb74483e15b320715",
"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 versions(first: 1) {\n edges {\n node {\n id\n status\n version\n signatures(first: 1000) {\n edges {\n node {\n id\n state\n }\n }\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 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"
} }
}; };
})(); })();

View File

@@ -254,7 +254,7 @@ export function DocumentList(props: {
checked={selection.includes(document.id)} checked={selection.includes(document.id)}
onCheck={() => toggle(document.id)} onCheck={() => toggle(document.id)}
key={document.id} key={document.id}
fKey={document} fragmentRef={document}
connectionId={connectionId} connectionId={connectionId}
hasAnyAction={hasAnyAction} hasAnyAction={hasAnyAction}
/> />

View File

@@ -2,7 +2,7 @@ import { formatDate, getDocumentClassificationLabel, getDocumentTypeLabel, sprin
import { useTranslate } from "@probo/i18n"; import { useTranslate } from "@probo/i18n";
import { ActionDropdown, Avatar, Badge, Checkbox, DropdownItem, IconTrashCan, Td, Tr, useConfirm } from "@probo/ui"; import { ActionDropdown, Avatar, Badge, Checkbox, DropdownItem, IconTrashCan, Td, Tr, useConfirm } from "@probo/ui";
import { useFragment } from "react-relay"; import { useFragment } from "react-relay";
import { graphql } from "relay-runtime"; import { type DataID, graphql } from "relay-runtime";
import type { DocumentListItem_deleteMutation } from "#/__generated__/core/DocumentListItem_deleteMutation.graphql"; import type { DocumentListItem_deleteMutation } from "#/__generated__/core/DocumentListItem_deleteMutation.graphql";
import type { DocumentListItemFragment$key } from "#/__generated__/core/DocumentListItemFragment.graphql"; import type { DocumentListItemFragment$key } from "#/__generated__/core/DocumentListItemFragment.graphql";
@@ -21,19 +21,17 @@ const fragment = graphql`
id id
fullName fullName
} }
versions(first: 1) { lastVersion: versions(first: 1 orderBy: { field: CREATED_AT direction: DESC }) {
edges { edges {
node { node {
id id
status status
version version
signatures(first: 1000) { signatures(first: 0 filter: { activeContract: true }) {
edges { totalCount
node {
id
state
}
} }
signedSignatures: signatures(first: 0 filter: { states: [SIGNED], activeContract: true }) {
totalCount
} }
} }
} }
@@ -53,15 +51,15 @@ const deleteDocumentMutation = graphql`
`; `;
export function DocumentListItem(props: { export function DocumentListItem(props: {
fKey: DocumentListItemFragment$key; fragmentRef: DocumentListItemFragment$key;
connectionId: string; connectionId: DataID;
checked: boolean; checked: boolean;
onCheck: () => void; onCheck: () => void;
hasAnyAction: boolean; hasAnyAction: boolean;
}) { }) {
const { const {
connectionId, connectionId,
fKey, fragmentRef,
checked, checked,
onCheck, onCheck,
hasAnyAction, hasAnyAction,
@@ -70,11 +68,11 @@ export function DocumentListItem(props: {
const organizationId = useOrganizationId(); const organizationId = useOrganizationId();
const document = useFragment<DocumentListItemFragment$key>( const document = useFragment<DocumentListItemFragment$key>(
fragment, fragment,
fKey, fragmentRef,
); );
const lastVersion = document.versions.edges?.[0]?.node; const lastVersion = document.lastVersion.edges[0].node;
const isDraft = lastVersion?.status === "DRAFT"; const isDraft = lastVersion.status === "DRAFT";
const { __ } = useTranslate(); const { __ } = useTranslate();
const [deleteDocument] = useMutationWithToasts<DocumentListItem_deleteMutation>( const [deleteDocument] = useMutationWithToasts<DocumentListItem_deleteMutation>(
@@ -86,17 +84,6 @@ export function DocumentListItem(props: {
); );
const confirm = useConfirm(); const confirm = useConfirm();
if (!lastVersion) {
return null;
}
const signatures
= lastVersion.signatures?.edges?.map(edge => edge?.node)?.filter(Boolean)
?? [];
const signedCount = signatures.filter(
signature => signature.state === "SIGNED",
).length;
const handleDelete = () => { const handleDelete = () => {
confirm( confirm(
() => () =>
@@ -148,9 +135,9 @@ export function DocumentListItem(props: {
</Td> </Td>
<Td className="w-60">{formatDate(document.updatedAt)}</Td> <Td className="w-60">{formatDate(document.updatedAt)}</Td>
<Td className="w-20"> <Td className="w-20">
{signedCount} {lastVersion.signedSignatures.totalCount}
/ /
{signatures.length} {lastVersion.signatures.totalCount}
</Td> </Td>
{hasAnyAction && ( {hasAnyAction && (
<Td noLink width={50} className="text-end w-18"> <Td noLink width={50} className="text-end w-18">