From 4bb7c116b920d619c002879f88644c83c33d01b8 Mon Sep 17 00:00:00 2001 From: gearnode Date: Thu, 27 Feb 2025 14:47:36 +0100 Subject: [PATCH] Refactor update payload Signed-off-by: gearnode --- apps/console/src/pages/PeopleOverviewPage.tsx | 26 +- .../console/src/pages/UpdateFrameworkPage.tsx | 10 +- apps/console/src/pages/VendorOverviewPage.tsx | 42 +- ...verviewPageUpdatePeopleMutation.graphql.ts | 125 +++-- ...workPageUpdateFrameworkMutation.graphql.ts | 77 +-- ...verviewPageUpdateVendorMutation.graphql.ts | 205 ++++---- pkg/api/console/v1/schema.graphql | 18 +- pkg/api/console/v1/schema/schema.go | 484 +++++++++++++++--- pkg/api/console/v1/types/types.go | 12 + pkg/api/console/v1/v1_resolver.go | 18 +- 10 files changed, 705 insertions(+), 312 deletions(-) diff --git a/apps/console/src/pages/PeopleOverviewPage.tsx b/apps/console/src/pages/PeopleOverviewPage.tsx index 13e92f9da..caaf70d07 100644 --- a/apps/console/src/pages/PeopleOverviewPage.tsx +++ b/apps/console/src/pages/PeopleOverviewPage.tsx @@ -39,13 +39,15 @@ const peopleOverviewPageQuery = graphql` const updatePeopleMutation = graphql` mutation PeopleOverviewPageUpdatePeopleMutation($input: UpdatePeopleInput!) { updatePeople(input: $input) { - id - fullName - primaryEmailAddress - additionalEmailAddresses - kind - updatedAt - version + people { + id + fullName + primaryEmailAddress + additionalEmailAddresses + kind + updatedAt + version + } } } `; @@ -96,7 +98,7 @@ function PeopleOverviewPageContent({ }); const [commit] = useMutation(updatePeopleMutation); const [, loadQuery] = useQueryLoader( - peopleOverviewPageQuery, + peopleOverviewPageQuery ); const { toast } = useToast(); @@ -198,7 +200,7 @@ function PeopleOverviewPageContent({ onClick={() => { const newEmails = formData.additionalEmailAddresses.filter( - (_, i) => i !== index, + (_, i) => i !== index ); handleFieldChange("additionalEmailAddresses", newEmails); }} @@ -243,7 +245,7 @@ function PeopleOverviewPageContent({ "rounded-full px-4 py-1 text-sm transition-colors", formData.kind === "EMPLOYEE" ? "bg-blue-100 text-blue-900 ring-2 ring-blue-600 ring-offset-2" - : "bg-gray-100 text-gray-900 hover:bg-gray-200", + : "bg-gray-100 text-gray-900 hover:bg-gray-200" )} > Employee @@ -254,7 +256,7 @@ function PeopleOverviewPageContent({ "rounded-full px-4 py-1 text-sm transition-colors", formData.kind === "CONTRACTOR" ? "bg-purple-100 text-purple-900 ring-2 ring-purple-600 ring-offset-2" - : "bg-gray-100 text-gray-900 hover:bg-gray-200", + : "bg-gray-100 text-gray-900 hover:bg-gray-200" )} > Contractor @@ -303,7 +305,7 @@ function PeopleOverviewPageFallback() { export default function PeopleOverviewPage() { const { peopleId } = useParams(); const [queryRef, loadQuery] = useQueryLoader( - peopleOverviewPageQuery, + peopleOverviewPageQuery ); useEffect(() => { diff --git a/apps/console/src/pages/UpdateFrameworkPage.tsx b/apps/console/src/pages/UpdateFrameworkPage.tsx index 36c6a2459..1c2c84cab 100644 --- a/apps/console/src/pages/UpdateFrameworkPage.tsx +++ b/apps/console/src/pages/UpdateFrameworkPage.tsx @@ -24,10 +24,12 @@ const updateFrameworkMutation = graphql` $input: UpdateFrameworkInput! ) { updateFramework(input: $input) { - id - name - description - version + framework { + id + name + description + version + } } } `; diff --git a/apps/console/src/pages/VendorOverviewPage.tsx b/apps/console/src/pages/VendorOverviewPage.tsx index e099c6d44..325c522be 100644 --- a/apps/console/src/pages/VendorOverviewPage.tsx +++ b/apps/console/src/pages/VendorOverviewPage.tsx @@ -44,18 +44,20 @@ const vendorOverviewPageQuery = graphql` const updateVendorMutation = graphql` mutation VendorOverviewPageUpdateVendorMutation($input: UpdateVendorInput!) { updateVendor(input: $input) { - id - name - description - serviceStartAt - serviceTerminationAt - serviceCriticality - riskTier - statusPageUrl - termsOfServiceUrl - privacyPolicyUrl - updatedAt - version + vendor { + id + name + description + serviceStartAt + serviceTerminationAt + serviceCriticality + riskTier + statusPageUrl + termsOfServiceUrl + privacyPolicyUrl + updatedAt + version + } } } `; @@ -125,7 +127,7 @@ function VendorOverviewPageContent({ }); const [commit] = useMutation(updateVendorMutation); const [, loadQuery] = useQueryLoader( - vendorOverviewPageQuery, + vendorOverviewPageQuery ); const { toast } = useToast(); @@ -259,7 +261,7 @@ function VendorOverviewPageContent({ "rounded-full px-4 py-1 text-sm transition-colors", formData.serviceCriticality === "LOW" ? "bg-green-100 text-green-900 ring-2 ring-green-600 ring-offset-2" - : "bg-gray-100 text-gray-900 hover:bg-gray-200", + : "bg-gray-100 text-gray-900 hover:bg-gray-200" )} > Low @@ -272,7 +274,7 @@ function VendorOverviewPageContent({ "rounded-full px-4 py-1 text-sm transition-colors", formData.serviceCriticality === "MEDIUM" ? "bg-yellow-100 text-yellow-900 ring-2 ring-yellow-600 ring-offset-2" - : "bg-gray-100 text-gray-900 hover:bg-gray-200", + : "bg-gray-100 text-gray-900 hover:bg-gray-200" )} > Medium @@ -285,7 +287,7 @@ function VendorOverviewPageContent({ "rounded-full px-4 py-1 text-sm transition-colors", formData.serviceCriticality === "HIGH" ? "bg-red-100 text-red-900 ring-2 ring-red-600 ring-offset-2" - : "bg-gray-100 text-gray-900 hover:bg-gray-200", + : "bg-gray-100 text-gray-900 hover:bg-gray-200" )} > High @@ -313,7 +315,7 @@ function VendorOverviewPageContent({ "rounded-full px-4 py-1 text-sm transition-colors", formData.riskTier === "CRITICAL" ? "bg-red-100 text-red-900 ring-2 ring-red-600 ring-offset-2" - : "bg-gray-100 text-gray-900 hover:bg-gray-200", + : "bg-gray-100 text-gray-900 hover:bg-gray-200" )} > Critical @@ -326,7 +328,7 @@ function VendorOverviewPageContent({ "rounded-full px-4 py-1 text-sm transition-colors", formData.riskTier === "SIGNIFICANT" ? "bg-yellow-100 text-yellow-900 ring-2 ring-yellow-600 ring-offset-2" - : "bg-gray-100 text-gray-900 hover:bg-gray-200", + : "bg-gray-100 text-gray-900 hover:bg-gray-200" )} > Significant @@ -337,7 +339,7 @@ function VendorOverviewPageContent({ "rounded-full px-4 py-1 text-sm transition-colors", formData.riskTier === "GENERAL" ? "bg-green-100 text-green-900 ring-2 ring-green-600 ring-offset-2" - : "bg-gray-100 text-gray-900 hover:bg-gray-200", + : "bg-gray-100 text-gray-900 hover:bg-gray-200" )} > General @@ -418,7 +420,7 @@ function VendorOverviewPageFallback() { export default function VendorOverviewPage() { const { vendorId } = useParams(); const [queryRef, loadQuery] = useQueryLoader( - vendorOverviewPageQuery, + vendorOverviewPageQuery ); useEffect(() => { diff --git a/apps/console/src/pages/__generated__/PeopleOverviewPageUpdatePeopleMutation.graphql.ts b/apps/console/src/pages/__generated__/PeopleOverviewPageUpdatePeopleMutation.graphql.ts index f4ad1427f..b288ab761 100644 --- a/apps/console/src/pages/__generated__/PeopleOverviewPageUpdatePeopleMutation.graphql.ts +++ b/apps/console/src/pages/__generated__/PeopleOverviewPageUpdatePeopleMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -23,13 +23,15 @@ export type PeopleOverviewPageUpdatePeopleMutation$variables = { }; export type PeopleOverviewPageUpdatePeopleMutation$data = { readonly updatePeople: { - readonly additionalEmailAddresses: ReadonlyArray; - readonly fullName: string; - readonly id: string; - readonly kind: PeopleKind; - readonly primaryEmailAddress: string; - readonly updatedAt: any; - readonly version: number; + readonly people: { + readonly additionalEmailAddresses: ReadonlyArray; + readonly fullName: string; + readonly id: string; + readonly kind: PeopleKind; + readonly primaryEmailAddress: string; + readonly updatedAt: any; + readonly version: number; + }; }; }; export type PeopleOverviewPageUpdatePeopleMutation = { @@ -55,7 +57,7 @@ v1 = [ "variableName": "input" } ], - "concreteType": "People", + "concreteType": "UpdatePeoplePayload", "kind": "LinkedField", "name": "updatePeople", "plural": false, @@ -63,50 +65,61 @@ v1 = [ { "alias": null, "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "fullName", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "primaryEmailAddress", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "additionalEmailAddresses", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "kind", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "updatedAt", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "version", + "concreteType": "People", + "kind": "LinkedField", + "name": "people", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "primaryEmailAddress", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "additionalEmailAddresses", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "kind", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "updatedAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "version", + "storageKey": null + } + ], "storageKey": null } ], @@ -131,16 +144,16 @@ return { "selections": (v1/*: any*/) }, "params": { - "cacheID": "85b62bd3c79a01fc437649a9c8a217b3", + "cacheID": "6961fac292b72111b2d0a46f078e3efc", "id": null, "metadata": {}, "name": "PeopleOverviewPageUpdatePeopleMutation", "operationKind": "mutation", - "text": "mutation PeopleOverviewPageUpdatePeopleMutation(\n $input: UpdatePeopleInput!\n) {\n updatePeople(input: $input) {\n id\n fullName\n primaryEmailAddress\n additionalEmailAddresses\n kind\n updatedAt\n version\n }\n}\n" + "text": "mutation PeopleOverviewPageUpdatePeopleMutation(\n $input: UpdatePeopleInput!\n) {\n updatePeople(input: $input) {\n people {\n id\n fullName\n primaryEmailAddress\n additionalEmailAddresses\n kind\n updatedAt\n version\n }\n }\n}\n" } }; })(); -(node as any).hash = "3fba4023eb9fa1520ed88bb9b4501dc7"; +(node as any).hash = "01a8fefe43cdc344f9a4dd62a60edc6c"; export default node; diff --git a/apps/console/src/pages/__generated__/UpdateFrameworkPageUpdateFrameworkMutation.graphql.ts b/apps/console/src/pages/__generated__/UpdateFrameworkPageUpdateFrameworkMutation.graphql.ts index 85d40014d..26ef5f5f4 100644 --- a/apps/console/src/pages/__generated__/UpdateFrameworkPageUpdateFrameworkMutation.graphql.ts +++ b/apps/console/src/pages/__generated__/UpdateFrameworkPageUpdateFrameworkMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<190ec3d14b98c4685fcc363fc41cee96>> + * @generated SignedSource<<822ef9b3867da7de4bca37e5be0e077e>> * @lightSyntaxTransform * @nogrep */ @@ -20,10 +20,12 @@ export type UpdateFrameworkPageUpdateFrameworkMutation$variables = { }; export type UpdateFrameworkPageUpdateFrameworkMutation$data = { readonly updateFramework: { - readonly description: string; - readonly id: string; - readonly name: string; - readonly version: number; + readonly framework: { + readonly description: string; + readonly id: string; + readonly name: string; + readonly version: number; + }; }; }; export type UpdateFrameworkPageUpdateFrameworkMutation = { @@ -49,7 +51,7 @@ v1 = [ "variableName": "input" } ], - "concreteType": "Framework", + "concreteType": "UpdateFrameworkPayload", "kind": "LinkedField", "name": "updateFramework", "plural": false, @@ -57,29 +59,40 @@ v1 = [ { "alias": null, "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "description", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "version", + "concreteType": "Framework", + "kind": "LinkedField", + "name": "framework", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "description", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "version", + "storageKey": null + } + ], "storageKey": null } ], @@ -104,16 +117,16 @@ return { "selections": (v1/*: any*/) }, "params": { - "cacheID": "f0f708c6034a6f3c27fbad0193535e51", + "cacheID": "d85d38851d3d94709a5b6c4090678ea4", "id": null, "metadata": {}, "name": "UpdateFrameworkPageUpdateFrameworkMutation", "operationKind": "mutation", - "text": "mutation UpdateFrameworkPageUpdateFrameworkMutation(\n $input: UpdateFrameworkInput!\n) {\n updateFramework(input: $input) {\n id\n name\n description\n version\n }\n}\n" + "text": "mutation UpdateFrameworkPageUpdateFrameworkMutation(\n $input: UpdateFrameworkInput!\n) {\n updateFramework(input: $input) {\n framework {\n id\n name\n description\n version\n }\n }\n}\n" } }; })(); -(node as any).hash = "b8a8cebfad0ef454a5d5436b61cc595c"; +(node as any).hash = "c363b35a095da9142d61907ca7ba3c62"; export default node; diff --git a/apps/console/src/pages/__generated__/VendorOverviewPageUpdateVendorMutation.graphql.ts b/apps/console/src/pages/__generated__/VendorOverviewPageUpdateVendorMutation.graphql.ts index 98cac8316..303ea7739 100644 --- a/apps/console/src/pages/__generated__/VendorOverviewPageUpdateVendorMutation.graphql.ts +++ b/apps/console/src/pages/__generated__/VendorOverviewPageUpdateVendorMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<0c1d84470c9beda41d05161fad1608f2>> + * @generated SignedSource<<6453606aec7f5a8548c5cc76e9d775f0>> * @lightSyntaxTransform * @nogrep */ @@ -29,18 +29,20 @@ export type VendorOverviewPageUpdateVendorMutation$variables = { }; export type VendorOverviewPageUpdateVendorMutation$data = { readonly updateVendor: { - readonly description: string; - readonly id: string; - readonly name: string; - readonly privacyPolicyUrl: string | null | undefined; - readonly riskTier: RiskTier; - readonly serviceCriticality: ServiceCriticality; - readonly serviceStartAt: any; - readonly serviceTerminationAt: any | null | undefined; - readonly statusPageUrl: string | null | undefined; - readonly termsOfServiceUrl: string | null | undefined; - readonly updatedAt: any; - readonly version: number; + readonly vendor: { + readonly description: string; + readonly id: string; + readonly name: string; + readonly privacyPolicyUrl: string | null | undefined; + readonly riskTier: RiskTier; + readonly serviceCriticality: ServiceCriticality; + readonly serviceStartAt: any; + readonly serviceTerminationAt: any | null | undefined; + readonly statusPageUrl: string | null | undefined; + readonly termsOfServiceUrl: string | null | undefined; + readonly updatedAt: any; + readonly version: number; + }; }; }; export type VendorOverviewPageUpdateVendorMutation = { @@ -66,7 +68,7 @@ v1 = [ "variableName": "input" } ], - "concreteType": "Vendor", + "concreteType": "UpdateVendorPayload", "kind": "LinkedField", "name": "updateVendor", "plural": false, @@ -74,85 +76,96 @@ v1 = [ { "alias": null, "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "description", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "serviceStartAt", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "serviceTerminationAt", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "serviceCriticality", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "riskTier", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "statusPageUrl", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "termsOfServiceUrl", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "privacyPolicyUrl", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "updatedAt", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "version", + "concreteType": "Vendor", + "kind": "LinkedField", + "name": "vendor", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "description", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "serviceStartAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "serviceTerminationAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "serviceCriticality", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "riskTier", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "statusPageUrl", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "termsOfServiceUrl", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "privacyPolicyUrl", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "updatedAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "version", + "storageKey": null + } + ], "storageKey": null } ], @@ -177,16 +190,16 @@ return { "selections": (v1/*: any*/) }, "params": { - "cacheID": "d0dd4f7b7219b20cc57a57e25b2b1197", + "cacheID": "30449b25e96907e852ae1638ab425111", "id": null, "metadata": {}, "name": "VendorOverviewPageUpdateVendorMutation", "operationKind": "mutation", - "text": "mutation VendorOverviewPageUpdateVendorMutation(\n $input: UpdateVendorInput!\n) {\n updateVendor(input: $input) {\n id\n name\n description\n serviceStartAt\n serviceTerminationAt\n serviceCriticality\n riskTier\n statusPageUrl\n termsOfServiceUrl\n privacyPolicyUrl\n updatedAt\n version\n }\n}\n" + "text": "mutation VendorOverviewPageUpdateVendorMutation(\n $input: UpdateVendorInput!\n) {\n updateVendor(input: $input) {\n vendor {\n id\n name\n description\n serviceStartAt\n serviceTerminationAt\n serviceCriticality\n riskTier\n statusPageUrl\n termsOfServiceUrl\n privacyPolicyUrl\n updatedAt\n version\n }\n }\n}\n" } }; })(); -(node as any).hash = "be093542424cdd4a329ec389312d0f83"; +(node as any).hash = "e07426684611544b6f4c8d1668a19794"; export default node; diff --git a/pkg/api/console/v1/schema.graphql b/pkg/api/console/v1/schema.graphql index b50bd01a0..f7aba5010 100644 --- a/pkg/api/console/v1/schema.graphql +++ b/pkg/api/console/v1/schema.graphql @@ -382,10 +382,10 @@ type Query { type Mutation { createVendor(input: CreateVendorInput!): CreateVendorPayload! - updateVendor(input: UpdateVendorInput!): Vendor! + updateVendor(input: UpdateVendorInput!): UpdateVendorPayload! deleteVendor(input: DeleteVendorInput!): DeleteVendorPayload! createPeople(input: CreatePeopleInput!): CreatePeoplePayload! - updatePeople(input: UpdatePeopleInput!): People! + updatePeople(input: UpdatePeopleInput!): UpdatePeoplePayload! deletePeople(input: DeletePeopleInput!): DeletePeoplePayload! createOrganization( input: CreateOrganizationInput! @@ -398,7 +398,7 @@ type Mutation { deleteTask(input: DeleteTaskInput!): DeleteTaskPayload! createFramework(input: CreateFrameworkInput!): CreateFrameworkPayload! createControl(input: CreateControlInput!): CreateControlPayload! - updateFramework(input: UpdateFrameworkInput!): Framework! + updateFramework(input: UpdateFrameworkInput!): UpdateFrameworkPayload! } input CreateVendorInput { @@ -573,3 +573,15 @@ input CreateControlInput { type CreateControlPayload { controlEdge: ControlEdge! } + +type UpdateFrameworkPayload { + framework: Framework! +} + +type UpdateVendorPayload { + vendor: Vendor! +} + +type UpdatePeoplePayload { + people: People! +} diff --git a/pkg/api/console/v1/schema/schema.go b/pkg/api/console/v1/schema/schema.go index 44ad9c8f4..23f48bfba 100644 --- a/pkg/api/console/v1/schema/schema.go +++ b/pkg/api/console/v1/schema/schema.go @@ -313,10 +313,22 @@ type ComplexityRoot struct { Node func(childComplexity int) int } + UpdateFrameworkPayload struct { + Framework func(childComplexity int) int + } + + UpdatePeoplePayload struct { + People func(childComplexity int) int + } + UpdateTaskStatePayload struct { Task func(childComplexity int) int } + UpdateVendorPayload struct { + Vendor func(childComplexity int) int + } + User struct { CreatedAt func(childComplexity int) int Email func(childComplexity int) int @@ -365,10 +377,10 @@ type FrameworkResolver interface { } type MutationResolver interface { CreateVendor(ctx context.Context, input types.CreateVendorInput) (*types.CreateVendorPayload, error) - UpdateVendor(ctx context.Context, input types.UpdateVendorInput) (*types.Vendor, error) + UpdateVendor(ctx context.Context, input types.UpdateVendorInput) (*types.UpdateVendorPayload, error) DeleteVendor(ctx context.Context, input types.DeleteVendorInput) (*types.DeleteVendorPayload, error) CreatePeople(ctx context.Context, input types.CreatePeopleInput) (*types.CreatePeoplePayload, error) - UpdatePeople(ctx context.Context, input types.UpdatePeopleInput) (*types.People, error) + UpdatePeople(ctx context.Context, input types.UpdatePeopleInput) (*types.UpdatePeoplePayload, error) DeletePeople(ctx context.Context, input types.DeletePeopleInput) (*types.DeletePeoplePayload, error) CreateOrganization(ctx context.Context, input types.CreateOrganizationInput) (*types.CreateOrganizationPayload, error) DeleteOrganization(ctx context.Context, input types.DeleteOrganizationInput) (*types.DeleteOrganizationPayload, error) @@ -377,7 +389,7 @@ type MutationResolver interface { DeleteTask(ctx context.Context, input types.DeleteTaskInput) (*types.DeleteTaskPayload, error) CreateFramework(ctx context.Context, input types.CreateFrameworkInput) (*types.CreateFrameworkPayload, error) CreateControl(ctx context.Context, input types.CreateControlInput) (*types.CreateControlPayload, error) - UpdateFramework(ctx context.Context, input types.UpdateFrameworkInput) (*types.Framework, error) + UpdateFramework(ctx context.Context, input types.UpdateFrameworkInput) (*types.UpdateFrameworkPayload, error) } type OrganizationResolver interface { Frameworks(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.FrameworkConnection, error) @@ -1473,6 +1485,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.TaskStateTransitionEdge.Node(childComplexity), true + case "UpdateFrameworkPayload.framework": + if e.complexity.UpdateFrameworkPayload.Framework == nil { + break + } + + return e.complexity.UpdateFrameworkPayload.Framework(childComplexity), true + + case "UpdatePeoplePayload.people": + if e.complexity.UpdatePeoplePayload.People == nil { + break + } + + return e.complexity.UpdatePeoplePayload.People(childComplexity), true + case "UpdateTaskStatePayload.task": if e.complexity.UpdateTaskStatePayload.Task == nil { break @@ -1480,6 +1506,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.UpdateTaskStatePayload.Task(childComplexity), true + case "UpdateVendorPayload.vendor": + if e.complexity.UpdateVendorPayload.Vendor == nil { + break + } + + return e.complexity.UpdateVendorPayload.Vendor(childComplexity), true + case "User.createdAt": if e.complexity.User.CreatedAt == nil { break @@ -2149,10 +2182,10 @@ type Query { type Mutation { createVendor(input: CreateVendorInput!): CreateVendorPayload! - updateVendor(input: UpdateVendorInput!): Vendor! + updateVendor(input: UpdateVendorInput!): UpdateVendorPayload! deleteVendor(input: DeleteVendorInput!): DeleteVendorPayload! createPeople(input: CreatePeopleInput!): CreatePeoplePayload! - updatePeople(input: UpdatePeopleInput!): People! + updatePeople(input: UpdatePeopleInput!): UpdatePeoplePayload! deletePeople(input: DeletePeopleInput!): DeletePeoplePayload! createOrganization( input: CreateOrganizationInput! @@ -2165,7 +2198,7 @@ type Mutation { deleteTask(input: DeleteTaskInput!): DeleteTaskPayload! createFramework(input: CreateFrameworkInput!): CreateFrameworkPayload! createControl(input: CreateControlInput!): CreateControlPayload! - updateFramework(input: UpdateFrameworkInput!): Framework! + updateFramework(input: UpdateFrameworkInput!): UpdateFrameworkPayload! } input CreateVendorInput { @@ -2340,6 +2373,18 @@ input CreateControlInput { type CreateControlPayload { controlEdge: ControlEdge! } + +type UpdateFrameworkPayload { + framework: Framework! +} + +type UpdateVendorPayload { + vendor: Vendor! +} + +type UpdatePeoplePayload { + people: People! +} `, BuiltIn: false}, } var parsedSchema = gqlparser.MustLoadSchema(sources...) @@ -6345,9 +6390,9 @@ func (ec *executionContext) _Mutation_updateVendor(ctx context.Context, field gr } return graphql.Null } - res := resTmp.(*types.Vendor) + res := resTmp.(*types.UpdateVendorPayload) fc.Result = res - return ec.marshalNVendor2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐVendor(ctx, field.Selections, res) + return ec.marshalNUpdateVendorPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateVendorPayload(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Mutation_updateVendor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -6358,34 +6403,10 @@ func (ec *executionContext) fieldContext_Mutation_updateVendor(ctx context.Conte IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Vendor_id(ctx, field) - case "name": - return ec.fieldContext_Vendor_name(ctx, field) - case "description": - return ec.fieldContext_Vendor_description(ctx, field) - case "serviceStartAt": - return ec.fieldContext_Vendor_serviceStartAt(ctx, field) - case "serviceTerminationAt": - return ec.fieldContext_Vendor_serviceTerminationAt(ctx, field) - case "serviceCriticality": - return ec.fieldContext_Vendor_serviceCriticality(ctx, field) - case "riskTier": - return ec.fieldContext_Vendor_riskTier(ctx, field) - case "statusPageUrl": - return ec.fieldContext_Vendor_statusPageUrl(ctx, field) - case "termsOfServiceUrl": - return ec.fieldContext_Vendor_termsOfServiceUrl(ctx, field) - case "privacyPolicyUrl": - return ec.fieldContext_Vendor_privacyPolicyUrl(ctx, field) - case "createdAt": - return ec.fieldContext_Vendor_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Vendor_updatedAt(ctx, field) - case "version": - return ec.fieldContext_Vendor_version(ctx, field) + case "vendor": + return ec.fieldContext_UpdateVendorPayload_vendor(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Vendor", field.Name) + return nil, fmt.Errorf("no field named %q was found under type UpdateVendorPayload", field.Name) }, } ctx = graphql.WithFieldContext(ctx, fc) @@ -6510,9 +6531,9 @@ func (ec *executionContext) _Mutation_updatePeople(ctx context.Context, field gr } return graphql.Null } - res := resTmp.(*types.People) + res := resTmp.(*types.UpdatePeoplePayload) fc.Result = res - return ec.marshalNPeople2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐPeople(ctx, field.Selections, res) + return ec.marshalNUpdatePeoplePayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePeoplePayload(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Mutation_updatePeople(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -6523,24 +6544,10 @@ func (ec *executionContext) fieldContext_Mutation_updatePeople(ctx context.Conte IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_People_id(ctx, field) - case "fullName": - return ec.fieldContext_People_fullName(ctx, field) - case "primaryEmailAddress": - return ec.fieldContext_People_primaryEmailAddress(ctx, field) - case "additionalEmailAddresses": - return ec.fieldContext_People_additionalEmailAddresses(ctx, field) - case "kind": - return ec.fieldContext_People_kind(ctx, field) - case "createdAt": - return ec.fieldContext_People_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_People_updatedAt(ctx, field) - case "version": - return ec.fieldContext_People_version(ctx, field) + case "people": + return ec.fieldContext_UpdatePeoplePayload_people(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type People", field.Name) + return nil, fmt.Errorf("no field named %q was found under type UpdatePeoplePayload", field.Name) }, } ctx = graphql.WithFieldContext(ctx, fc) @@ -6947,9 +6954,9 @@ func (ec *executionContext) _Mutation_updateFramework(ctx context.Context, field } return graphql.Null } - res := resTmp.(*types.Framework) + res := resTmp.(*types.UpdateFrameworkPayload) fc.Result = res - return ec.marshalNFramework2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐFramework(ctx, field.Selections, res) + return ec.marshalNUpdateFrameworkPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateFrameworkPayload(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Mutation_updateFramework(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -6960,22 +6967,10 @@ func (ec *executionContext) fieldContext_Mutation_updateFramework(ctx context.Co IsResolver: true, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "id": - return ec.fieldContext_Framework_id(ctx, field) - case "version": - return ec.fieldContext_Framework_version(ctx, field) - case "name": - return ec.fieldContext_Framework_name(ctx, field) - case "description": - return ec.fieldContext_Framework_description(ctx, field) - case "controls": - return ec.fieldContext_Framework_controls(ctx, field) - case "createdAt": - return ec.fieldContext_Framework_createdAt(ctx, field) - case "updatedAt": - return ec.fieldContext_Framework_updatedAt(ctx, field) + case "framework": + return ec.fieldContext_UpdateFrameworkPayload_framework(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type Framework", field.Name) + return nil, fmt.Errorf("no field named %q was found under type UpdateFrameworkPayload", field.Name) }, } ctx = graphql.WithFieldContext(ctx, fc) @@ -9343,6 +9338,116 @@ func (ec *executionContext) fieldContext_TaskStateTransitionEdge_node(_ context. return fc, nil } +func (ec *executionContext) _UpdateFrameworkPayload_framework(ctx context.Context, field graphql.CollectedField, obj *types.UpdateFrameworkPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateFrameworkPayload_framework(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Framework, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*types.Framework) + fc.Result = res + return ec.marshalNFramework2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐFramework(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UpdateFrameworkPayload_framework(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UpdateFrameworkPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Framework_id(ctx, field) + case "version": + return ec.fieldContext_Framework_version(ctx, field) + case "name": + return ec.fieldContext_Framework_name(ctx, field) + case "description": + return ec.fieldContext_Framework_description(ctx, field) + case "controls": + return ec.fieldContext_Framework_controls(ctx, field) + case "createdAt": + return ec.fieldContext_Framework_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Framework_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Framework", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _UpdatePeoplePayload_people(ctx context.Context, field graphql.CollectedField, obj *types.UpdatePeoplePayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdatePeoplePayload_people(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.People, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*types.People) + fc.Result = res + return ec.marshalNPeople2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐPeople(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UpdatePeoplePayload_people(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UpdatePeoplePayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_People_id(ctx, field) + case "fullName": + return ec.fieldContext_People_fullName(ctx, field) + case "primaryEmailAddress": + return ec.fieldContext_People_primaryEmailAddress(ctx, field) + case "additionalEmailAddresses": + return ec.fieldContext_People_additionalEmailAddresses(ctx, field) + case "kind": + return ec.fieldContext_People_kind(ctx, field) + case "createdAt": + return ec.fieldContext_People_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_People_updatedAt(ctx, field) + case "version": + return ec.fieldContext_People_version(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type People", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _UpdateTaskStatePayload_task(ctx context.Context, field graphql.CollectedField, obj *types.UpdateTaskStatePayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_UpdateTaskStatePayload_task(ctx, field) if err != nil { @@ -9399,6 +9504,72 @@ func (ec *executionContext) fieldContext_UpdateTaskStatePayload_task(_ context.C return fc, nil } +func (ec *executionContext) _UpdateVendorPayload_vendor(ctx context.Context, field graphql.CollectedField, obj *types.UpdateVendorPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateVendorPayload_vendor(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Vendor, nil + }) + if err != nil { + ec.Error(ctx, err) + return graphql.Null + } + if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } + return graphql.Null + } + res := resTmp.(*types.Vendor) + fc.Result = res + return ec.marshalNVendor2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐVendor(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UpdateVendorPayload_vendor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UpdateVendorPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Vendor_id(ctx, field) + case "name": + return ec.fieldContext_Vendor_name(ctx, field) + case "description": + return ec.fieldContext_Vendor_description(ctx, field) + case "serviceStartAt": + return ec.fieldContext_Vendor_serviceStartAt(ctx, field) + case "serviceTerminationAt": + return ec.fieldContext_Vendor_serviceTerminationAt(ctx, field) + case "serviceCriticality": + return ec.fieldContext_Vendor_serviceCriticality(ctx, field) + case "riskTier": + return ec.fieldContext_Vendor_riskTier(ctx, field) + case "statusPageUrl": + return ec.fieldContext_Vendor_statusPageUrl(ctx, field) + case "termsOfServiceUrl": + return ec.fieldContext_Vendor_termsOfServiceUrl(ctx, field) + case "privacyPolicyUrl": + return ec.fieldContext_Vendor_privacyPolicyUrl(ctx, field) + case "createdAt": + return ec.fieldContext_Vendor_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Vendor_updatedAt(ctx, field) + case "version": + return ec.fieldContext_Vendor_version(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Vendor", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *types.User) (ret graphql.Marshaler) { fc, err := ec.fieldContext_User_id(ctx, field) if err != nil { @@ -14941,6 +15112,84 @@ func (ec *executionContext) _TaskStateTransitionEdge(ctx context.Context, sel as return out } +var updateFrameworkPayloadImplementors = []string{"UpdateFrameworkPayload"} + +func (ec *executionContext) _UpdateFrameworkPayload(ctx context.Context, sel ast.SelectionSet, obj *types.UpdateFrameworkPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, updateFrameworkPayloadImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UpdateFrameworkPayload") + case "framework": + out.Values[i] = ec._UpdateFrameworkPayload_framework(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + +var updatePeoplePayloadImplementors = []string{"UpdatePeoplePayload"} + +func (ec *executionContext) _UpdatePeoplePayload(ctx context.Context, sel ast.SelectionSet, obj *types.UpdatePeoplePayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, updatePeoplePayloadImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UpdatePeoplePayload") + case "people": + out.Values[i] = ec._UpdatePeoplePayload_people(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var updateTaskStatePayloadImplementors = []string{"UpdateTaskStatePayload"} func (ec *executionContext) _UpdateTaskStatePayload(ctx context.Context, sel ast.SelectionSet, obj *types.UpdateTaskStatePayload) graphql.Marshaler { @@ -14980,6 +15229,45 @@ func (ec *executionContext) _UpdateTaskStatePayload(ctx context.Context, sel ast return out } +var updateVendorPayloadImplementors = []string{"UpdateVendorPayload"} + +func (ec *executionContext) _UpdateVendorPayload(ctx context.Context, sel ast.SelectionSet, obj *types.UpdateVendorPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, updateVendorPayloadImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("UpdateVendorPayload") + case "vendor": + out.Values[i] = ec._UpdateVendorPayload_vendor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var userImplementors = []string{"User", "Node"} func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj *types.User) graphql.Marshaler { @@ -16154,10 +16442,6 @@ func (ec *executionContext) marshalNEvidenceStateTransitionEdge2ᚖgithubᚗcom return ec._EvidenceStateTransitionEdge(ctx, sel, v) } -func (ec *executionContext) marshalNFramework2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐFramework(ctx context.Context, sel ast.SelectionSet, v types.Framework) graphql.Marshaler { - return ec._Framework(ctx, sel, &v) -} - func (ec *executionContext) marshalNFramework2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐFramework(ctx context.Context, sel ast.SelectionSet, v *types.Framework) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -16352,10 +16636,6 @@ func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋgetproboᚋprobo return ec._PageInfo(ctx, sel, v) } -func (ec *executionContext) marshalNPeople2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐPeople(ctx context.Context, sel ast.SelectionSet, v types.People) graphql.Marshaler { - return ec._People(ctx, sel, &v) -} - func (ec *executionContext) marshalNPeople2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐPeople(ctx context.Context, sel ast.SelectionSet, v *types.People) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -16736,11 +17016,39 @@ func (ec *executionContext) unmarshalNUpdateFrameworkInput2githubᚗcomᚋgetpro return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalNUpdateFrameworkPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateFrameworkPayload(ctx context.Context, sel ast.SelectionSet, v types.UpdateFrameworkPayload) graphql.Marshaler { + return ec._UpdateFrameworkPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUpdateFrameworkPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateFrameworkPayload(ctx context.Context, sel ast.SelectionSet, v *types.UpdateFrameworkPayload) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UpdateFrameworkPayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNUpdatePeopleInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePeopleInput(ctx context.Context, v any) (types.UpdatePeopleInput, error) { res, err := ec.unmarshalInputUpdatePeopleInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalNUpdatePeoplePayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePeoplePayload(ctx context.Context, sel ast.SelectionSet, v types.UpdatePeoplePayload) graphql.Marshaler { + return ec._UpdatePeoplePayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUpdatePeoplePayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdatePeoplePayload(ctx context.Context, sel ast.SelectionSet, v *types.UpdatePeoplePayload) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UpdatePeoplePayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNUpdateTaskStateInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateTaskStateInput(ctx context.Context, v any) (types.UpdateTaskStateInput, error) { res, err := ec.unmarshalInputUpdateTaskStateInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -16765,6 +17073,20 @@ func (ec *executionContext) unmarshalNUpdateVendorInput2githubᚗcomᚋgetprobo return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalNUpdateVendorPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateVendorPayload(ctx context.Context, sel ast.SelectionSet, v types.UpdateVendorPayload) graphql.Marshaler { + return ec._UpdateVendorPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUpdateVendorPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateVendorPayload(ctx context.Context, sel ast.SelectionSet, v *types.UpdateVendorPayload) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._UpdateVendorPayload(ctx, sel, v) +} + func (ec *executionContext) marshalNUser2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐUser(ctx context.Context, sel ast.SelectionSet, v types.User) graphql.Marshaler { return ec._User(ctx, sel, &v) } @@ -16779,10 +17101,6 @@ func (ec *executionContext) marshalNUser2ᚖgithubᚗcomᚋgetproboᚋproboᚋpk return ec._User(ctx, sel, v) } -func (ec *executionContext) marshalNVendor2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐVendor(ctx context.Context, sel ast.SelectionSet, v types.Vendor) graphql.Marshaler { - return ec._Vendor(ctx, sel, &v) -} - func (ec *executionContext) marshalNVendor2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐVendor(ctx context.Context, sel ast.SelectionSet, v *types.Vendor) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { diff --git a/pkg/api/console/v1/types/types.go b/pkg/api/console/v1/types/types.go index fd4723378..19f437d94 100644 --- a/pkg/api/console/v1/types/types.go +++ b/pkg/api/console/v1/types/types.go @@ -341,6 +341,10 @@ type UpdateFrameworkInput struct { Description *string `json:"description,omitempty"` } +type UpdateFrameworkPayload struct { + Framework *Framework `json:"framework"` +} + type UpdatePeopleInput struct { ID gid.GID `json:"id"` ExpectedVersion int `json:"expectedVersion"` @@ -350,6 +354,10 @@ type UpdatePeopleInput struct { Kind *coredata.PeopleKind `json:"kind,omitempty"` } +type UpdatePeoplePayload struct { + People *People `json:"people"` +} + type UpdateTaskStateInput struct { TaskID gid.GID `json:"taskId"` State coredata.TaskState `json:"state"` @@ -373,6 +381,10 @@ type UpdateVendorInput struct { PrivacyPolicyURL *string `json:"privacyPolicyUrl,omitempty"` } +type UpdateVendorPayload struct { + Vendor *Vendor `json:"vendor"` +} + type User struct { ID gid.GID `json:"id"` FullName string `json:"fullName"` diff --git a/pkg/api/console/v1/v1_resolver.go b/pkg/api/console/v1/v1_resolver.go index e4d2ab1fa..040a75e10 100644 --- a/pkg/api/console/v1/v1_resolver.go +++ b/pkg/api/console/v1/v1_resolver.go @@ -88,7 +88,7 @@ func (r *mutationResolver) CreateVendor(ctx context.Context, input types.CreateV } // UpdateVendor is the resolver for the updateVendor field. -func (r *mutationResolver) UpdateVendor(ctx context.Context, input types.UpdateVendorInput) (*types.Vendor, error) { +func (r *mutationResolver) UpdateVendor(ctx context.Context, input types.UpdateVendorInput) (*types.UpdateVendorPayload, error) { vendor, err := r.proboSvc.UpdateVendor(ctx, probo.UpdateVendorRequest{ ID: input.ID, ExpectedVersion: input.ExpectedVersion, @@ -106,7 +106,9 @@ func (r *mutationResolver) UpdateVendor(ctx context.Context, input types.UpdateV return nil, fmt.Errorf("cannot update vendor: %w", err) } - return types.NewVendor(vendor), nil + return &types.UpdateVendorPayload{ + Vendor: types.NewVendor(vendor), + }, nil } // DeleteVendor is the resolver for the deleteVendor field. @@ -141,7 +143,7 @@ func (r *mutationResolver) CreatePeople(ctx context.Context, input types.CreateP } // UpdatePeople is the resolver for the updatePeople field. -func (r *mutationResolver) UpdatePeople(ctx context.Context, input types.UpdatePeopleInput) (*types.People, error) { +func (r *mutationResolver) UpdatePeople(ctx context.Context, input types.UpdatePeopleInput) (*types.UpdatePeoplePayload, error) { people, err := r.proboSvc.UpdatePeople(ctx, probo.UpdatePeopleRequest{ ID: input.ID, ExpectedVersion: input.ExpectedVersion, @@ -154,7 +156,9 @@ func (r *mutationResolver) UpdatePeople(ctx context.Context, input types.UpdateP return nil, fmt.Errorf("cannot update people: %w", err) } - return types.NewPeople(people), nil + return &types.UpdatePeoplePayload{ + People: types.NewPeople(people), + }, nil } // DeletePeople is the resolver for the deletePeople field. @@ -271,7 +275,7 @@ func (r *mutationResolver) CreateControl(ctx context.Context, input types.Create } // UpdateFramework is the resolver for the updateFramework field. -func (r *mutationResolver) UpdateFramework(ctx context.Context, input types.UpdateFrameworkInput) (*types.Framework, error) { +func (r *mutationResolver) UpdateFramework(ctx context.Context, input types.UpdateFrameworkInput) (*types.UpdateFrameworkPayload, error) { framework, err := r.proboSvc.UpdateFramework(ctx, probo.UpdateFrameworkRequest{ ID: input.ID, ExpectedVersion: input.ExpectedVersion, @@ -282,7 +286,9 @@ func (r *mutationResolver) UpdateFramework(ctx context.Context, input types.Upda return nil, fmt.Errorf("cannot update framework: %w", err) } - return types.NewFramework(framework), nil + return &types.UpdateFrameworkPayload{ + Framework: types.NewFramework(framework), + }, nil } // Frameworks is the resolver for the frameworks field.