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 {
|
||||
node {
|
||||
id
|
||||
active
|
||||
requested
|
||||
status
|
||||
document {
|
||||
id
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<3d9ccb3632d0373c627c87f6e6585673>>
|
||||
* @generated SignedSource<<72bab693664bbf68879e863c85f980b5>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -19,7 +19,6 @@ export type TrustCenterAccessGraphLoadDocumentAccessesQuery$data = {
|
||||
readonly availableDocumentAccesses?: {
|
||||
readonly edges: ReadonlyArray<{
|
||||
readonly node: {
|
||||
readonly active: boolean;
|
||||
readonly document: {
|
||||
readonly documentType: DocumentType;
|
||||
readonly id: string;
|
||||
@@ -36,7 +35,6 @@ export type TrustCenterAccessGraphLoadDocumentAccessesQuery$data = {
|
||||
readonly filename: string;
|
||||
readonly id: string;
|
||||
} | null | undefined;
|
||||
readonly requested: boolean;
|
||||
readonly status: TrustCenterDocumentAccessStatus;
|
||||
readonly trustCenterFile: {
|
||||
readonly category: string;
|
||||
@@ -92,27 +90,13 @@ v3 = [
|
||||
}
|
||||
],
|
||||
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,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "status",
|
||||
"storageKey": null
|
||||
},
|
||||
v7 = {
|
||||
v5 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "Document",
|
||||
@@ -138,21 +122,21 @@ v7 = {
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
v8 = {
|
||||
v6 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "filename",
|
||||
"storageKey": null
|
||||
},
|
||||
v9 = {
|
||||
v7 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"kind": "ScalarField",
|
||||
"name": "name",
|
||||
"storageKey": null
|
||||
},
|
||||
v10 = {
|
||||
v8 = {
|
||||
"alias": null,
|
||||
"args": null,
|
||||
"concreteType": "TrustCenterFile",
|
||||
@@ -161,7 +145,7 @@ v10 = {
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v9/*: any*/),
|
||||
(v7/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -218,8 +202,6 @@ return {
|
||||
(v2/*: any*/),
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/),
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -229,7 +211,7 @@ return {
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v6/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -247,7 +229,7 @@ return {
|
||||
"name": "framework",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v9/*: any*/)
|
||||
(v7/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
@@ -257,7 +239,7 @@ return {
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v10/*: any*/)
|
||||
(v8/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
@@ -330,8 +312,6 @@ return {
|
||||
(v2/*: any*/),
|
||||
(v4/*: any*/),
|
||||
(v5/*: any*/),
|
||||
(v6/*: any*/),
|
||||
(v7/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -341,7 +321,7 @@ return {
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v2/*: any*/),
|
||||
(v8/*: any*/),
|
||||
(v6/*: any*/),
|
||||
{
|
||||
"alias": null,
|
||||
"args": null,
|
||||
@@ -359,7 +339,7 @@ return {
|
||||
"name": "framework",
|
||||
"plural": false,
|
||||
"selections": [
|
||||
(v9/*: any*/),
|
||||
(v7/*: any*/),
|
||||
(v2/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
@@ -370,7 +350,7 @@ return {
|
||||
],
|
||||
"storageKey": null
|
||||
},
|
||||
(v10/*: any*/)
|
||||
(v8/*: any*/)
|
||||
],
|
||||
"storageKey": null
|
||||
}
|
||||
@@ -390,16 +370,16 @@ return {
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"cacheID": "a590c829b3c88e4fa4fe146771c723b9",
|
||||
"cacheID": "a3c6d83c3fae9bd8ab3e474706423115",
|
||||
"id": null,
|
||||
"metadata": {},
|
||||
"name": "TrustCenterAccessGraphLoadDocumentAccessesQuery",
|
||||
"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;
|
||||
|
||||
@@ -9,9 +9,7 @@ export type TrustCenterDocumentAccessStatus = (typeof trustCenterDocumentAccessS
|
||||
|
||||
export type TrustCenterDocumentAccess = {
|
||||
id: string;
|
||||
active: boolean;
|
||||
status: TrustCenterDocumentAccessStatus;
|
||||
requested: boolean;
|
||||
document?: {
|
||||
id: string;
|
||||
title: string;
|
||||
|
||||
@@ -25,41 +25,30 @@ export function getTrustCenterDocumentAccessStatusLabel(status: TrustCenterDocum
|
||||
}
|
||||
}
|
||||
|
||||
export type TrustCenterDocumentAccessInfo = {
|
||||
interface ITrustCenterDocumentAccessInfo {
|
||||
variant: string;
|
||||
type: string;
|
||||
persisted: boolean;
|
||||
variant: "info",
|
||||
name: string,
|
||||
type: "document",
|
||||
typeLabel: string,
|
||||
category: 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;
|
||||
}
|
||||
|
||||
export type TrustCenterDocumentAccessInfo = ITrustCenterDocumentAccessInfo & (
|
||||
{
|
||||
variant: "info",
|
||||
type: "document",
|
||||
} | {
|
||||
variant: "success",
|
||||
type: "report",
|
||||
} | {
|
||||
variant: "highlight",
|
||||
type: "file",
|
||||
}
|
||||
)
|
||||
|
||||
export function getTrustCenterDocumentAccessInfo(
|
||||
docAccess: TrustCenterDocumentAccess,
|
||||
__: (key: string) => string
|
||||
@@ -73,8 +62,6 @@ export function getTrustCenterDocumentAccessInfo(
|
||||
typeLabel: __("Document"),
|
||||
category: docAccess.document.documentType,
|
||||
id: docAccess.document.id,
|
||||
requested: docAccess.requested,
|
||||
active: docAccess.active,
|
||||
status: docAccess.status,
|
||||
};
|
||||
}
|
||||
@@ -87,8 +74,6 @@ export function getTrustCenterDocumentAccessInfo(
|
||||
typeLabel: __("Report"),
|
||||
category: docAccess.report.audit?.framework.name ?? "",
|
||||
id: docAccess.report.id,
|
||||
requested: docAccess.requested,
|
||||
active: docAccess.active,
|
||||
status: docAccess.status,
|
||||
};
|
||||
}
|
||||
@@ -101,8 +86,6 @@ export function getTrustCenterDocumentAccessInfo(
|
||||
typeLabel: __("File"),
|
||||
category: docAccess.trustCenterFile.category,
|
||||
id: docAccess.trustCenterFile.id,
|
||||
requested: docAccess.requested,
|
||||
active: docAccess.active,
|
||||
status: docAccess.status,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -36,9 +36,7 @@ type (
|
||||
DocumentID *gid.GID `db:"document_id"`
|
||||
ReportID *gid.GID `db:"report_id"`
|
||||
TrustCenterFileID *gid.GID `db:"trust_center_file_id"`
|
||||
Active bool `db:"active"`
|
||||
Status TrustCenterDocumentAccessStatus `db:"status"`
|
||||
Requested bool `db:"requested"`
|
||||
CreatedAt time.Time `db:"created_at"`
|
||||
UpdatedAt time.Time `db:"updated_at"`
|
||||
}
|
||||
@@ -239,9 +237,7 @@ INSERT INTO trust_center_document_accesses (
|
||||
document_id,
|
||||
report_id,
|
||||
trust_center_file_id,
|
||||
active,
|
||||
status,
|
||||
requested,
|
||||
created_at,
|
||||
updated_at
|
||||
) VALUES (
|
||||
@@ -252,9 +248,7 @@ INSERT INTO trust_center_document_accesses (
|
||||
@document_id,
|
||||
@report_id,
|
||||
@trust_center_file_id,
|
||||
@active,
|
||||
@status::trust_center_document_access_status,
|
||||
@requested,
|
||||
@created_at,
|
||||
@updated_at
|
||||
)
|
||||
@@ -269,8 +263,6 @@ INSERT INTO trust_center_document_accesses (
|
||||
"report_id": tcda.ReportID,
|
||||
"trust_center_file_id": tcda.TrustCenterFileID,
|
||||
"status": tcda.Status,
|
||||
"active": tcda.Active,
|
||||
"requested": tcda.Requested,
|
||||
"created_at": tcda.CreatedAt,
|
||||
"updated_at": tcda.UpdatedAt,
|
||||
}
|
||||
@@ -534,9 +526,7 @@ final_items AS (
|
||||
ai.document_id,
|
||||
ai.report_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.requested, false) AS requested,
|
||||
COALESCE(tcda.created_at, ai.item_created_at) AS created_at,
|
||||
COALESCE(tcda.updated_at, ai.item_updated_at) AS updated_at
|
||||
FROM all_items ai
|
||||
@@ -556,9 +546,7 @@ SELECT
|
||||
document_id,
|
||||
report_id,
|
||||
trust_center_file_id,
|
||||
active,
|
||||
status,
|
||||
requested,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM final_items
|
||||
@@ -602,9 +590,7 @@ SELECT
|
||||
document_id,
|
||||
report_id,
|
||||
trust_center_file_id,
|
||||
active,
|
||||
status,
|
||||
requested,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM
|
||||
@@ -827,9 +813,7 @@ WHEN NOT MATCHED
|
||||
document_id,
|
||||
report_id,
|
||||
trust_center_file_id,
|
||||
active,
|
||||
status,
|
||||
requested,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
@@ -841,9 +825,7 @@ WHEN NOT MATCHED
|
||||
data.id,
|
||||
NULL,
|
||||
NULL,
|
||||
false,
|
||||
data.status,
|
||||
false,
|
||||
@now::timestamptz,
|
||||
@now::timestamptz
|
||||
)
|
||||
@@ -889,9 +871,7 @@ WITH document_access_data AS (
|
||||
unnest(@document_ids::text[]) AS document_id,
|
||||
null::text AS report_id,
|
||||
null::text AS trust_center_file_id,
|
||||
false AS active,
|
||||
@status::trust_center_document_access_status AS status,
|
||||
false AS requested,
|
||||
@created_at::timestamptz AS created_at,
|
||||
@updated_at::timestamptz AS updated_at
|
||||
)
|
||||
@@ -903,9 +883,7 @@ INSERT INTO trust_center_document_accesses (
|
||||
document_id,
|
||||
report_id,
|
||||
trust_center_file_id,
|
||||
active,
|
||||
status,
|
||||
requested,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
@@ -970,9 +948,7 @@ WHEN NOT MATCHED
|
||||
document_id,
|
||||
report_id,
|
||||
trust_center_file_id,
|
||||
active,
|
||||
status,
|
||||
requested,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
@@ -984,9 +960,7 @@ WHEN NOT MATCHED
|
||||
NULL,
|
||||
data.id,
|
||||
NULL,
|
||||
false,
|
||||
data.status,
|
||||
false,
|
||||
@now::timestamptz,
|
||||
@now::timestamptz
|
||||
)
|
||||
@@ -1032,9 +1006,7 @@ WITH report_access_data AS (
|
||||
null::text AS document_id,
|
||||
unnest(@report_ids::text[]) AS report_id,
|
||||
null::text AS trust_center_file_id,
|
||||
false AS active,
|
||||
@status::trust_center_document_access_status AS status,
|
||||
false AS requested,
|
||||
@created_at::timestamptz AS created_at,
|
||||
@updated_at::timestamptz AS updated_at
|
||||
)
|
||||
@@ -1046,9 +1018,7 @@ INSERT INTO trust_center_document_accesses (
|
||||
document_id,
|
||||
report_id,
|
||||
trust_center_file_id,
|
||||
active,
|
||||
status,
|
||||
requested,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
@@ -1088,9 +1058,7 @@ SELECT
|
||||
document_id,
|
||||
report_id,
|
||||
trust_center_file_id,
|
||||
active,
|
||||
status,
|
||||
requested,
|
||||
created_at,
|
||||
updated_at
|
||||
FROM
|
||||
@@ -1237,9 +1205,7 @@ WHEN NOT MATCHED
|
||||
document_id,
|
||||
report_id,
|
||||
trust_center_file_id,
|
||||
active,
|
||||
status,
|
||||
requested,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
@@ -1251,9 +1217,7 @@ WHEN NOT MATCHED
|
||||
NULL,
|
||||
NULL,
|
||||
data.id,
|
||||
false,
|
||||
data.status,
|
||||
false,
|
||||
@now::timestamptz,
|
||||
@now::timestamptz
|
||||
)
|
||||
@@ -1295,9 +1259,7 @@ WITH trust_center_file_access_data AS (
|
||||
null::text AS document_id,
|
||||
null::text AS report_id,
|
||||
unnest(@trust_center_file_ids::text[]) AS trust_center_file_id,
|
||||
false AS active,
|
||||
@status::trust_center_document_access_status AS status,
|
||||
false AS requested,
|
||||
@created_at::timestamptz AS created_at,
|
||||
@updated_at::timestamptz AS updated_at
|
||||
)
|
||||
@@ -1309,9 +1271,7 @@ INSERT INTO trust_center_document_accesses (
|
||||
document_id,
|
||||
report_id,
|
||||
trust_center_file_id,
|
||||
active,
|
||||
status,
|
||||
requested,
|
||||
created_at,
|
||||
updated_at
|
||||
)
|
||||
|
||||
@@ -2364,9 +2364,7 @@ type TrustCenterDocumentAccess
|
||||
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.TrustCenterDocumentAccess"
|
||||
) {
|
||||
id: ID!
|
||||
active: Boolean!
|
||||
status: TrustCenterDocumentAccessStatus!
|
||||
requested: Boolean!
|
||||
document: Document @goField(forceResolver: true)
|
||||
report: Report @goField(forceResolver: true)
|
||||
trustCenterFile: TrustCenterFile @goField(forceResolver: true)
|
||||
|
||||
@@ -1452,11 +1452,9 @@ type ComplexityRoot struct {
|
||||
}
|
||||
|
||||
TrustCenterDocumentAccess struct {
|
||||
Active func(childComplexity int) int
|
||||
Document func(childComplexity int) int
|
||||
ID func(childComplexity int) int
|
||||
Report func(childComplexity int) int
|
||||
Requested func(childComplexity int) int
|
||||
Status 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
|
||||
|
||||
case "TrustCenterDocumentAccess.active":
|
||||
if e.complexity.TrustCenterDocumentAccess.Active == nil {
|
||||
break
|
||||
}
|
||||
|
||||
return e.complexity.TrustCenterDocumentAccess.Active(childComplexity), true
|
||||
case "TrustCenterDocumentAccess.document":
|
||||
if e.complexity.TrustCenterDocumentAccess.Document == nil {
|
||||
break
|
||||
@@ -8035,12 +8027,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
||||
}
|
||||
|
||||
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":
|
||||
if e.complexity.TrustCenterDocumentAccess.Status == nil {
|
||||
break
|
||||
@@ -11932,9 +11918,7 @@ type TrustCenterDocumentAccess
|
||||
model: "go.probo.inc/probo/pkg/server/api/console/v1/types.TrustCenterDocumentAccess"
|
||||
) {
|
||||
id: ID!
|
||||
active: Boolean!
|
||||
status: TrustCenterDocumentAccessStatus!
|
||||
requested: Boolean!
|
||||
document: Document @goField(forceResolver: true)
|
||||
report: Report @goField(forceResolver: true)
|
||||
trustCenterFile: TrustCenterFile @goField(forceResolver: true)
|
||||
@@ -47166,35 +47150,6 @@ func (ec *executionContext) fieldContext_TrustCenterDocumentAccess_id(_ context.
|
||||
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) {
|
||||
return graphql.ResolveField(
|
||||
ctx,
|
||||
@@ -47224,35 +47179,6 @@ func (ec *executionContext) fieldContext_TrustCenterDocumentAccess_status(_ cont
|
||||
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) {
|
||||
return graphql.ResolveField(
|
||||
ctx,
|
||||
@@ -47564,12 +47490,8 @@ func (ec *executionContext) fieldContext_TrustCenterDocumentAccessEdge_node(_ co
|
||||
switch field.Name {
|
||||
case "id":
|
||||
return ec.fieldContext_TrustCenterDocumentAccess_id(ctx, field)
|
||||
case "active":
|
||||
return ec.fieldContext_TrustCenterDocumentAccess_active(ctx, field)
|
||||
case "status":
|
||||
return ec.fieldContext_TrustCenterDocumentAccess_status(ctx, field)
|
||||
case "requested":
|
||||
return ec.fieldContext_TrustCenterDocumentAccess_requested(ctx, field)
|
||||
case "document":
|
||||
return ec.fieldContext_TrustCenterDocumentAccess_document(ctx, field)
|
||||
case "report":
|
||||
@@ -78903,21 +78825,11 @@ func (ec *executionContext) _TrustCenterDocumentAccess(ctx context.Context, sel
|
||||
if out.Values[i] == graphql.Null {
|
||||
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":
|
||||
out.Values[i] = ec._TrustCenterDocumentAccess_status(ctx, field, obj)
|
||||
if out.Values[i] == graphql.Null {
|
||||
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":
|
||||
field := field
|
||||
|
||||
|
||||
@@ -37,9 +37,7 @@ type (
|
||||
TrustCenterDocumentAccess struct {
|
||||
ID gid.GID `json:"id"`
|
||||
OrganizationID gid.GID `json:"-"`
|
||||
Active bool `json:"active"`
|
||||
Status coredata.TrustCenterDocumentAccessStatus `json:"status"`
|
||||
Requested bool `json:"requested"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
TrustCenterAccess *TrustCenterAccess `json:"trustCenterAccess"`
|
||||
@@ -59,9 +57,7 @@ func NewTrustCenterDocumentAccess(tcda *coredata.TrustCenterDocumentAccess) *Tru
|
||||
return &TrustCenterDocumentAccess{
|
||||
ID: tcda.ID,
|
||||
OrganizationID: tcda.OrganizationID,
|
||||
Active: tcda.Active,
|
||||
Status: tcda.Status,
|
||||
Requested: tcda.Requested,
|
||||
CreatedAt: tcda.CreatedAt,
|
||||
UpdatedAt: tcda.UpdatedAt,
|
||||
TrustCenterAccessID: tcda.TrustCenterAccessID,
|
||||
|
||||
@@ -87,7 +87,7 @@ func (r *documentResolver) IsUserAuthorized(ctx context.Context, obj *types.Docu
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return documentAccess.Active, nil
|
||||
return documentAccess.Status == coredata.TrustCenterDocumentAccessStatusGranted, nil
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
|
||||
if !documentAccess.Active {
|
||||
if documentAccess.Status != coredata.TrustCenterDocumentAccessStatusGranted {
|
||||
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))
|
||||
}
|
||||
|
||||
if !reportAccess.Active {
|
||||
if reportAccess.Status != coredata.TrustCenterDocumentAccessStatusGranted {
|
||||
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))
|
||||
}
|
||||
|
||||
if !fileAccess.Active {
|
||||
if fileAccess.Status != coredata.TrustCenterDocumentAccessStatusGranted {
|
||||
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 reportAccess.Active, nil
|
||||
return reportAccess.Status == coredata.TrustCenterDocumentAccessStatusGranted, nil
|
||||
}
|
||||
|
||||
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 fileAccess.Active, nil
|
||||
return fileAccess.Status == coredata.TrustCenterDocumentAccessStatusGranted, nil
|
||||
}
|
||||
|
||||
panic(fmt.Errorf("no user or token data found"))
|
||||
|
||||
Reference in New Issue
Block a user