Clean active and requested
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
@@ -111,8 +111,6 @@ export const loadTrustCenterAccessDocumentAccessesQuery = graphql`
|
|||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
id
|
||||||
active
|
|
||||||
requested
|
|
||||||
status
|
status
|
||||||
document {
|
document {
|
||||||
id
|
id
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<3d9ccb3632d0373c627c87f6e6585673>>
|
* @generated SignedSource<<72bab693664bbf68879e863c85f980b5>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -19,7 +19,6 @@ export type TrustCenterAccessGraphLoadDocumentAccessesQuery$data = {
|
|||||||
readonly availableDocumentAccesses?: {
|
readonly availableDocumentAccesses?: {
|
||||||
readonly edges: ReadonlyArray<{
|
readonly edges: ReadonlyArray<{
|
||||||
readonly node: {
|
readonly node: {
|
||||||
readonly active: boolean;
|
|
||||||
readonly document: {
|
readonly document: {
|
||||||
readonly documentType: DocumentType;
|
readonly documentType: DocumentType;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
@@ -36,7 +35,6 @@ export type TrustCenterAccessGraphLoadDocumentAccessesQuery$data = {
|
|||||||
readonly filename: string;
|
readonly filename: string;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
} | null | undefined;
|
} | null | undefined;
|
||||||
readonly requested: boolean;
|
|
||||||
readonly status: TrustCenterDocumentAccessStatus;
|
readonly status: TrustCenterDocumentAccessStatus;
|
||||||
readonly trustCenterFile: {
|
readonly trustCenterFile: {
|
||||||
readonly category: string;
|
readonly category: string;
|
||||||
@@ -92,27 +90,13 @@ v3 = [
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
v4 = {
|
v4 = {
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "active",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
v5 = {
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "requested",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
v6 = {
|
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "status",
|
"name": "status",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v7 = {
|
v5 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"concreteType": "Document",
|
"concreteType": "Document",
|
||||||
@@ -138,21 +122,21 @@ v7 = {
|
|||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v8 = {
|
v6 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "filename",
|
"name": "filename",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v9 = {
|
v7 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "name",
|
"name": "name",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v10 = {
|
v8 = {
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"concreteType": "TrustCenterFile",
|
"concreteType": "TrustCenterFile",
|
||||||
@@ -161,7 +145,7 @@ v10 = {
|
|||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v2/*: any*/),
|
(v2/*: any*/),
|
||||||
(v9/*: any*/),
|
(v7/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -218,8 +202,6 @@ return {
|
|||||||
(v2/*: any*/),
|
(v2/*: any*/),
|
||||||
(v4/*: any*/),
|
(v4/*: any*/),
|
||||||
(v5/*: any*/),
|
(v5/*: any*/),
|
||||||
(v6/*: any*/),
|
|
||||||
(v7/*: any*/),
|
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -229,7 +211,7 @@ return {
|
|||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v2/*: any*/),
|
(v2/*: any*/),
|
||||||
(v8/*: any*/),
|
(v6/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -247,7 +229,7 @@ return {
|
|||||||
"name": "framework",
|
"name": "framework",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v9/*: any*/)
|
(v7/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
}
|
}
|
||||||
@@ -257,7 +239,7 @@ return {
|
|||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v10/*: any*/)
|
(v8/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
}
|
}
|
||||||
@@ -330,8 +312,6 @@ return {
|
|||||||
(v2/*: any*/),
|
(v2/*: any*/),
|
||||||
(v4/*: any*/),
|
(v4/*: any*/),
|
||||||
(v5/*: any*/),
|
(v5/*: any*/),
|
||||||
(v6/*: any*/),
|
|
||||||
(v7/*: any*/),
|
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -341,7 +321,7 @@ return {
|
|||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v2/*: any*/),
|
(v2/*: any*/),
|
||||||
(v8/*: any*/),
|
(v6/*: any*/),
|
||||||
{
|
{
|
||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
@@ -359,7 +339,7 @@ return {
|
|||||||
"name": "framework",
|
"name": "framework",
|
||||||
"plural": false,
|
"plural": false,
|
||||||
"selections": [
|
"selections": [
|
||||||
(v9/*: any*/),
|
(v7/*: any*/),
|
||||||
(v2/*: any*/)
|
(v2/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
@@ -370,7 +350,7 @@ return {
|
|||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v10/*: any*/)
|
(v8/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
}
|
}
|
||||||
@@ -390,16 +370,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "a590c829b3c88e4fa4fe146771c723b9",
|
"cacheID": "a3c6d83c3fae9bd8ab3e474706423115",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterAccessGraphLoadDocumentAccessesQuery",
|
"name": "TrustCenterAccessGraphLoadDocumentAccessesQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query TrustCenterAccessGraphLoadDocumentAccessesQuery(\n $accessId: ID!\n) {\n node(id: $accessId) {\n __typename\n ... on TrustCenterAccess {\n id\n availableDocumentAccesses(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n active\n requested\n status\n document {\n id\n title\n documentType\n }\n report {\n id\n filename\n audit {\n id\n framework {\n name\n id\n }\n }\n }\n trustCenterFile {\n id\n name\n category\n }\n }\n }\n }\n }\n id\n }\n}\n"
|
"text": "query TrustCenterAccessGraphLoadDocumentAccessesQuery(\n $accessId: ID!\n) {\n node(id: $accessId) {\n __typename\n ... on TrustCenterAccess {\n id\n availableDocumentAccesses(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n status\n document {\n id\n title\n documentType\n }\n report {\n id\n filename\n audit {\n id\n framework {\n name\n id\n }\n }\n }\n trustCenterFile {\n id\n name\n category\n }\n }\n }\n }\n }\n id\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "1145528ffc9c1576b8e5dd6d58e64a9c";
|
(node as any).hash = "f2fad3a04a700d1a9b045d1fa09e470c";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -9,9 +9,7 @@ export type TrustCenterDocumentAccessStatus = (typeof trustCenterDocumentAccessS
|
|||||||
|
|
||||||
export type TrustCenterDocumentAccess = {
|
export type TrustCenterDocumentAccess = {
|
||||||
id: string;
|
id: string;
|
||||||
active: boolean;
|
|
||||||
status: TrustCenterDocumentAccessStatus;
|
status: TrustCenterDocumentAccessStatus;
|
||||||
requested: boolean;
|
|
||||||
document?: {
|
document?: {
|
||||||
id: string;
|
id: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
|||||||
@@ -25,41 +25,30 @@ export function getTrustCenterDocumentAccessStatusLabel(status: TrustCenterDocum
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TrustCenterDocumentAccessInfo = {
|
interface ITrustCenterDocumentAccessInfo {
|
||||||
|
variant: string;
|
||||||
|
type: string;
|
||||||
persisted: boolean;
|
persisted: boolean;
|
||||||
variant: "info",
|
|
||||||
name: string,
|
name: string,
|
||||||
type: "document",
|
|
||||||
typeLabel: string,
|
typeLabel: string,
|
||||||
category: string;
|
category: string;
|
||||||
id: string;
|
id: string;
|
||||||
requested: boolean;
|
|
||||||
active: boolean;
|
|
||||||
status: TrustCenterDocumentAccessStatus;
|
|
||||||
} | {
|
|
||||||
persisted: boolean;
|
|
||||||
variant: "success",
|
|
||||||
name: string,
|
|
||||||
type: "report",
|
|
||||||
typeLabel: string,
|
|
||||||
category: string;
|
|
||||||
id: string;
|
|
||||||
requested: boolean;
|
|
||||||
active: boolean;
|
|
||||||
status: TrustCenterDocumentAccessStatus;
|
|
||||||
} | {
|
|
||||||
persisted: boolean;
|
|
||||||
variant: "highlight",
|
|
||||||
name: string,
|
|
||||||
type: "file",
|
|
||||||
typeLabel: string,
|
|
||||||
category: string;
|
|
||||||
id: string;
|
|
||||||
requested: boolean;
|
|
||||||
active: boolean;
|
|
||||||
status: TrustCenterDocumentAccessStatus;
|
status: TrustCenterDocumentAccessStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type TrustCenterDocumentAccessInfo = ITrustCenterDocumentAccessInfo & (
|
||||||
|
{
|
||||||
|
variant: "info",
|
||||||
|
type: "document",
|
||||||
|
} | {
|
||||||
|
variant: "success",
|
||||||
|
type: "report",
|
||||||
|
} | {
|
||||||
|
variant: "highlight",
|
||||||
|
type: "file",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
export function getTrustCenterDocumentAccessInfo(
|
export function getTrustCenterDocumentAccessInfo(
|
||||||
docAccess: TrustCenterDocumentAccess,
|
docAccess: TrustCenterDocumentAccess,
|
||||||
__: (key: string) => string
|
__: (key: string) => string
|
||||||
@@ -73,8 +62,6 @@ export function getTrustCenterDocumentAccessInfo(
|
|||||||
typeLabel: __("Document"),
|
typeLabel: __("Document"),
|
||||||
category: docAccess.document.documentType,
|
category: docAccess.document.documentType,
|
||||||
id: docAccess.document.id,
|
id: docAccess.document.id,
|
||||||
requested: docAccess.requested,
|
|
||||||
active: docAccess.active,
|
|
||||||
status: docAccess.status,
|
status: docAccess.status,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -87,8 +74,6 @@ export function getTrustCenterDocumentAccessInfo(
|
|||||||
typeLabel: __("Report"),
|
typeLabel: __("Report"),
|
||||||
category: docAccess.report.audit?.framework.name ?? "",
|
category: docAccess.report.audit?.framework.name ?? "",
|
||||||
id: docAccess.report.id,
|
id: docAccess.report.id,
|
||||||
requested: docAccess.requested,
|
|
||||||
active: docAccess.active,
|
|
||||||
status: docAccess.status,
|
status: docAccess.status,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -101,8 +86,6 @@ export function getTrustCenterDocumentAccessInfo(
|
|||||||
typeLabel: __("File"),
|
typeLabel: __("File"),
|
||||||
category: docAccess.trustCenterFile.category,
|
category: docAccess.trustCenterFile.category,
|
||||||
id: docAccess.trustCenterFile.id,
|
id: docAccess.trustCenterFile.id,
|
||||||
requested: docAccess.requested,
|
|
||||||
active: docAccess.active,
|
|
||||||
status: docAccess.status,
|
status: docAccess.status,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,9 +36,7 @@ type (
|
|||||||
DocumentID *gid.GID `db:"document_id"`
|
DocumentID *gid.GID `db:"document_id"`
|
||||||
ReportID *gid.GID `db:"report_id"`
|
ReportID *gid.GID `db:"report_id"`
|
||||||
TrustCenterFileID *gid.GID `db:"trust_center_file_id"`
|
TrustCenterFileID *gid.GID `db:"trust_center_file_id"`
|
||||||
Active bool `db:"active"`
|
|
||||||
Status TrustCenterDocumentAccessStatus `db:"status"`
|
Status TrustCenterDocumentAccessStatus `db:"status"`
|
||||||
Requested bool `db:"requested"`
|
|
||||||
CreatedAt time.Time `db:"created_at"`
|
CreatedAt time.Time `db:"created_at"`
|
||||||
UpdatedAt time.Time `db:"updated_at"`
|
UpdatedAt time.Time `db:"updated_at"`
|
||||||
}
|
}
|
||||||
@@ -239,9 +237,7 @@ INSERT INTO trust_center_document_accesses (
|
|||||||
document_id,
|
document_id,
|
||||||
report_id,
|
report_id,
|
||||||
trust_center_file_id,
|
trust_center_file_id,
|
||||||
active,
|
|
||||||
status,
|
status,
|
||||||
requested,
|
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
) VALUES (
|
) VALUES (
|
||||||
@@ -252,9 +248,7 @@ INSERT INTO trust_center_document_accesses (
|
|||||||
@document_id,
|
@document_id,
|
||||||
@report_id,
|
@report_id,
|
||||||
@trust_center_file_id,
|
@trust_center_file_id,
|
||||||
@active,
|
|
||||||
@status::trust_center_document_access_status,
|
@status::trust_center_document_access_status,
|
||||||
@requested,
|
|
||||||
@created_at,
|
@created_at,
|
||||||
@updated_at
|
@updated_at
|
||||||
)
|
)
|
||||||
@@ -269,8 +263,6 @@ INSERT INTO trust_center_document_accesses (
|
|||||||
"report_id": tcda.ReportID,
|
"report_id": tcda.ReportID,
|
||||||
"trust_center_file_id": tcda.TrustCenterFileID,
|
"trust_center_file_id": tcda.TrustCenterFileID,
|
||||||
"status": tcda.Status,
|
"status": tcda.Status,
|
||||||
"active": tcda.Active,
|
|
||||||
"requested": tcda.Requested,
|
|
||||||
"created_at": tcda.CreatedAt,
|
"created_at": tcda.CreatedAt,
|
||||||
"updated_at": tcda.UpdatedAt,
|
"updated_at": tcda.UpdatedAt,
|
||||||
}
|
}
|
||||||
@@ -534,9 +526,7 @@ final_items AS (
|
|||||||
ai.document_id,
|
ai.document_id,
|
||||||
ai.report_id,
|
ai.report_id,
|
||||||
ai.trust_center_file_id,
|
ai.trust_center_file_id,
|
||||||
COALESCE(tcda.active, false) AS active,
|
|
||||||
COALESCE(tcda.status, 'REQUESTED'::trust_center_document_access_status) AS status,
|
COALESCE(tcda.status, 'REQUESTED'::trust_center_document_access_status) AS status,
|
||||||
COALESCE(tcda.requested, false) AS requested,
|
|
||||||
COALESCE(tcda.created_at, ai.item_created_at) AS created_at,
|
COALESCE(tcda.created_at, ai.item_created_at) AS created_at,
|
||||||
COALESCE(tcda.updated_at, ai.item_updated_at) AS updated_at
|
COALESCE(tcda.updated_at, ai.item_updated_at) AS updated_at
|
||||||
FROM all_items ai
|
FROM all_items ai
|
||||||
@@ -556,9 +546,7 @@ SELECT
|
|||||||
document_id,
|
document_id,
|
||||||
report_id,
|
report_id,
|
||||||
trust_center_file_id,
|
trust_center_file_id,
|
||||||
active,
|
|
||||||
status,
|
status,
|
||||||
requested,
|
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM final_items
|
FROM final_items
|
||||||
@@ -602,9 +590,7 @@ SELECT
|
|||||||
document_id,
|
document_id,
|
||||||
report_id,
|
report_id,
|
||||||
trust_center_file_id,
|
trust_center_file_id,
|
||||||
active,
|
|
||||||
status,
|
status,
|
||||||
requested,
|
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM
|
FROM
|
||||||
@@ -827,9 +813,7 @@ WHEN NOT MATCHED
|
|||||||
document_id,
|
document_id,
|
||||||
report_id,
|
report_id,
|
||||||
trust_center_file_id,
|
trust_center_file_id,
|
||||||
active,
|
|
||||||
status,
|
status,
|
||||||
requested,
|
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
)
|
)
|
||||||
@@ -841,9 +825,7 @@ WHEN NOT MATCHED
|
|||||||
data.id,
|
data.id,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
false,
|
|
||||||
data.status,
|
data.status,
|
||||||
false,
|
|
||||||
@now::timestamptz,
|
@now::timestamptz,
|
||||||
@now::timestamptz
|
@now::timestamptz
|
||||||
)
|
)
|
||||||
@@ -889,9 +871,7 @@ WITH document_access_data AS (
|
|||||||
unnest(@document_ids::text[]) AS document_id,
|
unnest(@document_ids::text[]) AS document_id,
|
||||||
null::text AS report_id,
|
null::text AS report_id,
|
||||||
null::text AS trust_center_file_id,
|
null::text AS trust_center_file_id,
|
||||||
false AS active,
|
|
||||||
@status::trust_center_document_access_status AS status,
|
@status::trust_center_document_access_status AS status,
|
||||||
false AS requested,
|
|
||||||
@created_at::timestamptz AS created_at,
|
@created_at::timestamptz AS created_at,
|
||||||
@updated_at::timestamptz AS updated_at
|
@updated_at::timestamptz AS updated_at
|
||||||
)
|
)
|
||||||
@@ -903,9 +883,7 @@ INSERT INTO trust_center_document_accesses (
|
|||||||
document_id,
|
document_id,
|
||||||
report_id,
|
report_id,
|
||||||
trust_center_file_id,
|
trust_center_file_id,
|
||||||
active,
|
|
||||||
status,
|
status,
|
||||||
requested,
|
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
)
|
)
|
||||||
@@ -970,9 +948,7 @@ WHEN NOT MATCHED
|
|||||||
document_id,
|
document_id,
|
||||||
report_id,
|
report_id,
|
||||||
trust_center_file_id,
|
trust_center_file_id,
|
||||||
active,
|
|
||||||
status,
|
status,
|
||||||
requested,
|
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
)
|
)
|
||||||
@@ -984,9 +960,7 @@ WHEN NOT MATCHED
|
|||||||
NULL,
|
NULL,
|
||||||
data.id,
|
data.id,
|
||||||
NULL,
|
NULL,
|
||||||
false,
|
|
||||||
data.status,
|
data.status,
|
||||||
false,
|
|
||||||
@now::timestamptz,
|
@now::timestamptz,
|
||||||
@now::timestamptz
|
@now::timestamptz
|
||||||
)
|
)
|
||||||
@@ -1032,9 +1006,7 @@ WITH report_access_data AS (
|
|||||||
null::text AS document_id,
|
null::text AS document_id,
|
||||||
unnest(@report_ids::text[]) AS report_id,
|
unnest(@report_ids::text[]) AS report_id,
|
||||||
null::text AS trust_center_file_id,
|
null::text AS trust_center_file_id,
|
||||||
false AS active,
|
|
||||||
@status::trust_center_document_access_status AS status,
|
@status::trust_center_document_access_status AS status,
|
||||||
false AS requested,
|
|
||||||
@created_at::timestamptz AS created_at,
|
@created_at::timestamptz AS created_at,
|
||||||
@updated_at::timestamptz AS updated_at
|
@updated_at::timestamptz AS updated_at
|
||||||
)
|
)
|
||||||
@@ -1046,9 +1018,7 @@ INSERT INTO trust_center_document_accesses (
|
|||||||
document_id,
|
document_id,
|
||||||
report_id,
|
report_id,
|
||||||
trust_center_file_id,
|
trust_center_file_id,
|
||||||
active,
|
|
||||||
status,
|
status,
|
||||||
requested,
|
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
)
|
)
|
||||||
@@ -1088,9 +1058,7 @@ SELECT
|
|||||||
document_id,
|
document_id,
|
||||||
report_id,
|
report_id,
|
||||||
trust_center_file_id,
|
trust_center_file_id,
|
||||||
active,
|
|
||||||
status,
|
status,
|
||||||
requested,
|
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM
|
FROM
|
||||||
@@ -1237,9 +1205,7 @@ WHEN NOT MATCHED
|
|||||||
document_id,
|
document_id,
|
||||||
report_id,
|
report_id,
|
||||||
trust_center_file_id,
|
trust_center_file_id,
|
||||||
active,
|
|
||||||
status,
|
status,
|
||||||
requested,
|
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
)
|
)
|
||||||
@@ -1251,9 +1217,7 @@ WHEN NOT MATCHED
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
data.id,
|
data.id,
|
||||||
false,
|
|
||||||
data.status,
|
data.status,
|
||||||
false,
|
|
||||||
@now::timestamptz,
|
@now::timestamptz,
|
||||||
@now::timestamptz
|
@now::timestamptz
|
||||||
)
|
)
|
||||||
@@ -1295,9 +1259,7 @@ WITH trust_center_file_access_data AS (
|
|||||||
null::text AS document_id,
|
null::text AS document_id,
|
||||||
null::text AS report_id,
|
null::text AS report_id,
|
||||||
unnest(@trust_center_file_ids::text[]) AS trust_center_file_id,
|
unnest(@trust_center_file_ids::text[]) AS trust_center_file_id,
|
||||||
false AS active,
|
|
||||||
@status::trust_center_document_access_status AS status,
|
@status::trust_center_document_access_status AS status,
|
||||||
false AS requested,
|
|
||||||
@created_at::timestamptz AS created_at,
|
@created_at::timestamptz AS created_at,
|
||||||
@updated_at::timestamptz AS updated_at
|
@updated_at::timestamptz AS updated_at
|
||||||
)
|
)
|
||||||
@@ -1309,9 +1271,7 @@ INSERT INTO trust_center_document_accesses (
|
|||||||
document_id,
|
document_id,
|
||||||
report_id,
|
report_id,
|
||||||
trust_center_file_id,
|
trust_center_file_id,
|
||||||
active,
|
|
||||||
status,
|
status,
|
||||||
requested,
|
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2364,9 +2364,7 @@ type TrustCenterDocumentAccess
|
|||||||
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.TrustCenterDocumentAccess"
|
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.TrustCenterDocumentAccess"
|
||||||
) {
|
) {
|
||||||
id: ID!
|
id: ID!
|
||||||
active: Boolean!
|
|
||||||
status: TrustCenterDocumentAccessStatus!
|
status: TrustCenterDocumentAccessStatus!
|
||||||
requested: Boolean!
|
|
||||||
document: Document @goField(forceResolver: true)
|
document: Document @goField(forceResolver: true)
|
||||||
report: Report @goField(forceResolver: true)
|
report: Report @goField(forceResolver: true)
|
||||||
trustCenterFile: TrustCenterFile @goField(forceResolver: true)
|
trustCenterFile: TrustCenterFile @goField(forceResolver: true)
|
||||||
|
|||||||
@@ -1452,11 +1452,9 @@ type ComplexityRoot struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TrustCenterDocumentAccess struct {
|
TrustCenterDocumentAccess struct {
|
||||||
Active func(childComplexity int) int
|
|
||||||
Document func(childComplexity int) int
|
Document func(childComplexity int) int
|
||||||
ID func(childComplexity int) int
|
ID func(childComplexity int) int
|
||||||
Report func(childComplexity int) int
|
Report func(childComplexity int) int
|
||||||
Requested func(childComplexity int) int
|
|
||||||
Status func(childComplexity int) int
|
Status func(childComplexity int) int
|
||||||
TrustCenterFile func(childComplexity int) int
|
TrustCenterFile func(childComplexity int) int
|
||||||
}
|
}
|
||||||
@@ -8011,12 +8009,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
|
|
||||||
return e.complexity.TrustCenterConnection.PageInfo(childComplexity), true
|
return e.complexity.TrustCenterConnection.PageInfo(childComplexity), true
|
||||||
|
|
||||||
case "TrustCenterDocumentAccess.active":
|
|
||||||
if e.complexity.TrustCenterDocumentAccess.Active == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
return e.complexity.TrustCenterDocumentAccess.Active(childComplexity), true
|
|
||||||
case "TrustCenterDocumentAccess.document":
|
case "TrustCenterDocumentAccess.document":
|
||||||
if e.complexity.TrustCenterDocumentAccess.Document == nil {
|
if e.complexity.TrustCenterDocumentAccess.Document == nil {
|
||||||
break
|
break
|
||||||
@@ -8035,12 +8027,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
}
|
}
|
||||||
|
|
||||||
return e.complexity.TrustCenterDocumentAccess.Report(childComplexity), true
|
return e.complexity.TrustCenterDocumentAccess.Report(childComplexity), true
|
||||||
case "TrustCenterDocumentAccess.requested":
|
|
||||||
if e.complexity.TrustCenterDocumentAccess.Requested == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
return e.complexity.TrustCenterDocumentAccess.Requested(childComplexity), true
|
|
||||||
case "TrustCenterDocumentAccess.status":
|
case "TrustCenterDocumentAccess.status":
|
||||||
if e.complexity.TrustCenterDocumentAccess.Status == nil {
|
if e.complexity.TrustCenterDocumentAccess.Status == nil {
|
||||||
break
|
break
|
||||||
@@ -11932,9 +11918,7 @@ type TrustCenterDocumentAccess
|
|||||||
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.TrustCenterDocumentAccess"
|
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.TrustCenterDocumentAccess"
|
||||||
) {
|
) {
|
||||||
id: ID!
|
id: ID!
|
||||||
active: Boolean!
|
|
||||||
status: TrustCenterDocumentAccessStatus!
|
status: TrustCenterDocumentAccessStatus!
|
||||||
requested: Boolean!
|
|
||||||
document: Document @goField(forceResolver: true)
|
document: Document @goField(forceResolver: true)
|
||||||
report: Report @goField(forceResolver: true)
|
report: Report @goField(forceResolver: true)
|
||||||
trustCenterFile: TrustCenterFile @goField(forceResolver: true)
|
trustCenterFile: TrustCenterFile @goField(forceResolver: true)
|
||||||
@@ -47166,35 +47150,6 @@ func (ec *executionContext) fieldContext_TrustCenterDocumentAccess_id(_ context.
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _TrustCenterDocumentAccess_active(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterDocumentAccess) (ret graphql.Marshaler) {
|
|
||||||
return graphql.ResolveField(
|
|
||||||
ctx,
|
|
||||||
ec.OperationContext,
|
|
||||||
field,
|
|
||||||
ec.fieldContext_TrustCenterDocumentAccess_active,
|
|
||||||
func(ctx context.Context) (any, error) {
|
|
||||||
return obj.Active, nil
|
|
||||||
},
|
|
||||||
nil,
|
|
||||||
ec.marshalNBoolean2bool,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) fieldContext_TrustCenterDocumentAccess_active(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
|
||||||
fc = &graphql.FieldContext{
|
|
||||||
Object: "TrustCenterDocumentAccess",
|
|
||||||
Field: field,
|
|
||||||
IsMethod: false,
|
|
||||||
IsResolver: false,
|
|
||||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
|
||||||
return nil, errors.New("field of type Boolean does not have child fields")
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return fc, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) _TrustCenterDocumentAccess_status(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterDocumentAccess) (ret graphql.Marshaler) {
|
func (ec *executionContext) _TrustCenterDocumentAccess_status(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterDocumentAccess) (ret graphql.Marshaler) {
|
||||||
return graphql.ResolveField(
|
return graphql.ResolveField(
|
||||||
ctx,
|
ctx,
|
||||||
@@ -47224,35 +47179,6 @@ func (ec *executionContext) fieldContext_TrustCenterDocumentAccess_status(_ cont
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _TrustCenterDocumentAccess_requested(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterDocumentAccess) (ret graphql.Marshaler) {
|
|
||||||
return graphql.ResolveField(
|
|
||||||
ctx,
|
|
||||||
ec.OperationContext,
|
|
||||||
field,
|
|
||||||
ec.fieldContext_TrustCenterDocumentAccess_requested,
|
|
||||||
func(ctx context.Context) (any, error) {
|
|
||||||
return obj.Requested, nil
|
|
||||||
},
|
|
||||||
nil,
|
|
||||||
ec.marshalNBoolean2bool,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) fieldContext_TrustCenterDocumentAccess_requested(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
|
||||||
fc = &graphql.FieldContext{
|
|
||||||
Object: "TrustCenterDocumentAccess",
|
|
||||||
Field: field,
|
|
||||||
IsMethod: false,
|
|
||||||
IsResolver: false,
|
|
||||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
|
||||||
return nil, errors.New("field of type Boolean does not have child fields")
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return fc, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ec *executionContext) _TrustCenterDocumentAccess_document(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterDocumentAccess) (ret graphql.Marshaler) {
|
func (ec *executionContext) _TrustCenterDocumentAccess_document(ctx context.Context, field graphql.CollectedField, obj *types.TrustCenterDocumentAccess) (ret graphql.Marshaler) {
|
||||||
return graphql.ResolveField(
|
return graphql.ResolveField(
|
||||||
ctx,
|
ctx,
|
||||||
@@ -47564,12 +47490,8 @@ func (ec *executionContext) fieldContext_TrustCenterDocumentAccessEdge_node(_ co
|
|||||||
switch field.Name {
|
switch field.Name {
|
||||||
case "id":
|
case "id":
|
||||||
return ec.fieldContext_TrustCenterDocumentAccess_id(ctx, field)
|
return ec.fieldContext_TrustCenterDocumentAccess_id(ctx, field)
|
||||||
case "active":
|
|
||||||
return ec.fieldContext_TrustCenterDocumentAccess_active(ctx, field)
|
|
||||||
case "status":
|
case "status":
|
||||||
return ec.fieldContext_TrustCenterDocumentAccess_status(ctx, field)
|
return ec.fieldContext_TrustCenterDocumentAccess_status(ctx, field)
|
||||||
case "requested":
|
|
||||||
return ec.fieldContext_TrustCenterDocumentAccess_requested(ctx, field)
|
|
||||||
case "document":
|
case "document":
|
||||||
return ec.fieldContext_TrustCenterDocumentAccess_document(ctx, field)
|
return ec.fieldContext_TrustCenterDocumentAccess_document(ctx, field)
|
||||||
case "report":
|
case "report":
|
||||||
@@ -78903,21 +78825,11 @@ func (ec *executionContext) _TrustCenterDocumentAccess(ctx context.Context, sel
|
|||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
atomic.AddUint32(&out.Invalids, 1)
|
atomic.AddUint32(&out.Invalids, 1)
|
||||||
}
|
}
|
||||||
case "active":
|
|
||||||
out.Values[i] = ec._TrustCenterDocumentAccess_active(ctx, field, obj)
|
|
||||||
if out.Values[i] == graphql.Null {
|
|
||||||
atomic.AddUint32(&out.Invalids, 1)
|
|
||||||
}
|
|
||||||
case "status":
|
case "status":
|
||||||
out.Values[i] = ec._TrustCenterDocumentAccess_status(ctx, field, obj)
|
out.Values[i] = ec._TrustCenterDocumentAccess_status(ctx, field, obj)
|
||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
atomic.AddUint32(&out.Invalids, 1)
|
atomic.AddUint32(&out.Invalids, 1)
|
||||||
}
|
}
|
||||||
case "requested":
|
|
||||||
out.Values[i] = ec._TrustCenterDocumentAccess_requested(ctx, field, obj)
|
|
||||||
if out.Values[i] == graphql.Null {
|
|
||||||
atomic.AddUint32(&out.Invalids, 1)
|
|
||||||
}
|
|
||||||
case "document":
|
case "document":
|
||||||
field := field
|
field := field
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,7 @@ type (
|
|||||||
TrustCenterDocumentAccess struct {
|
TrustCenterDocumentAccess struct {
|
||||||
ID gid.GID `json:"id"`
|
ID gid.GID `json:"id"`
|
||||||
OrganizationID gid.GID `json:"-"`
|
OrganizationID gid.GID `json:"-"`
|
||||||
Active bool `json:"active"`
|
|
||||||
Status coredata.TrustCenterDocumentAccessStatus `json:"status"`
|
Status coredata.TrustCenterDocumentAccessStatus `json:"status"`
|
||||||
Requested bool `json:"requested"`
|
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
UpdatedAt time.Time `json:"updatedAt"`
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
TrustCenterAccess *TrustCenterAccess `json:"trustCenterAccess"`
|
TrustCenterAccess *TrustCenterAccess `json:"trustCenterAccess"`
|
||||||
@@ -59,9 +57,7 @@ func NewTrustCenterDocumentAccess(tcda *coredata.TrustCenterDocumentAccess) *Tru
|
|||||||
return &TrustCenterDocumentAccess{
|
return &TrustCenterDocumentAccess{
|
||||||
ID: tcda.ID,
|
ID: tcda.ID,
|
||||||
OrganizationID: tcda.OrganizationID,
|
OrganizationID: tcda.OrganizationID,
|
||||||
Active: tcda.Active,
|
|
||||||
Status: tcda.Status,
|
Status: tcda.Status,
|
||||||
Requested: tcda.Requested,
|
|
||||||
CreatedAt: tcda.CreatedAt,
|
CreatedAt: tcda.CreatedAt,
|
||||||
UpdatedAt: tcda.UpdatedAt,
|
UpdatedAt: tcda.UpdatedAt,
|
||||||
TrustCenterAccessID: tcda.TrustCenterAccessID,
|
TrustCenterAccessID: tcda.TrustCenterAccessID,
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ func (r *documentResolver) IsUserAuthorized(ctx context.Context, obj *types.Docu
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return documentAccess.Active, nil
|
return documentAccess.Status == coredata.TrustCenterDocumentAccessStatusGranted, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
panic(fmt.Errorf("no user or token data found"))
|
panic(fmt.Errorf("no user or token data found"))
|
||||||
@@ -213,7 +213,7 @@ func (r *mutationResolver) ExportDocumentPDF(ctx context.Context, input types.Ex
|
|||||||
panic(fmt.Errorf("cannot check document access: %w", err))
|
panic(fmt.Errorf("cannot check document access: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if !documentAccess.Active {
|
if documentAccess.Status != coredata.TrustCenterDocumentAccessStatusGranted {
|
||||||
return nil, fmt.Errorf("access denied: no permission to access this document")
|
return nil, fmt.Errorf("access denied: no permission to access this document")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ func (r *mutationResolver) ExportReportPDF(ctx context.Context, input types.Expo
|
|||||||
panic(fmt.Errorf("cannot check report access: %w", err))
|
panic(fmt.Errorf("cannot check report access: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if !reportAccess.Active {
|
if reportAccess.Status != coredata.TrustCenterDocumentAccessStatusGranted {
|
||||||
return nil, fmt.Errorf("access denied: no permission to access this report")
|
return nil, fmt.Errorf("access denied: no permission to access this report")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -549,7 +549,7 @@ func (r *mutationResolver) ExportTrustCenterFile(ctx context.Context, input type
|
|||||||
panic(fmt.Errorf("cannot check trust center file access: %w", err))
|
panic(fmt.Errorf("cannot check trust center file access: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if !fileAccess.Active {
|
if fileAccess.Status != coredata.TrustCenterDocumentAccessStatusGranted {
|
||||||
return nil, fmt.Errorf("access denied: no permission to access this file")
|
return nil, fmt.Errorf("access denied: no permission to access this file")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -748,7 +748,7 @@ func (r *reportResolver) IsUserAuthorized(ctx context.Context, obj *types.Report
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return reportAccess.Active, nil
|
return reportAccess.Status == coredata.TrustCenterDocumentAccessStatusGranted, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
panic(fmt.Errorf("no user or token data found"))
|
panic(fmt.Errorf("no user or token data found"))
|
||||||
@@ -952,7 +952,7 @@ func (r *trustCenterFileResolver) IsUserAuthorized(ctx context.Context, obj *typ
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return fileAccess.Active, nil
|
return fileAccess.Status == coredata.TrustCenterDocumentAccessStatusGranted, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
panic(fmt.Errorf("no user or token data found"))
|
panic(fmt.Errorf("no user or token data found"))
|
||||||
|
|||||||
Reference in New Issue
Block a user