From 49c3807b4fda0481a70f72173c058d543befd010 Mon Sep 17 00:00:00 2001 From: gearnode Date: Tue, 25 Feb 2025 15:23:29 +0100 Subject: [PATCH] Introduce viewer object Signed-off-by: gearnode --- apps/console/.env.development | 8 + apps/console/src/components/AppSidebar.tsx | 8 +- .../__generated__/AppSidebarQuery.graphql.ts | 140 +-- apps/console/src/layouts/ConsoleLayout.tsx | 8 +- apps/console/src/pages/CreatePeoplePage.tsx | 24 +- apps/console/src/pages/FrameworkListPage.tsx | 14 +- apps/console/src/pages/HomePage.tsx | 4 +- apps/console/src/pages/PeopleListPage.tsx | 30 +- apps/console/src/pages/SettingsPage.tsx | 6 +- apps/console/src/pages/VendorListPage.tsx | 37 +- .../CreatePeoplePageQuery.graphql.ts | 110 +-- .../FrameworkListPageQuery.graphql.ts | 220 ++--- .../__generated__/HomePageQuery.graphql.ts | 829 +++++++++--------- .../PeopleListPageQuery.graphql.ts | 92 +- .../SettingsPageQuery.graphql.ts | 104 +-- .../VendorListPageQuery.graphql.ts | 92 +- pkg/api/console/v1/schema.graphql | 119 ++- pkg/api/console/v1/schema/schema.go | 406 ++++++++- pkg/api/console/v1/types/types.go | 5 + pkg/api/console/v1/v1_resolver.go | 20 + 20 files changed, 1373 insertions(+), 903 deletions(-) create mode 100644 apps/console/.env.development diff --git a/apps/console/.env.development b/apps/console/.env.development new file mode 100644 index 000000000..ff157e773 --- /dev/null +++ b/apps/console/.env.development @@ -0,0 +1,8 @@ +LIVE_RELOAD= + +POSTHOG_HOST= +POSTHOG_KEY= +FARO_PUSH_URL= + +API_SERVER_HOST="http://localhost:8080" + diff --git a/apps/console/src/components/AppSidebar.tsx b/apps/console/src/components/AppSidebar.tsx index ac88b8615..a67e4caac 100644 --- a/apps/console/src/components/AppSidebar.tsx +++ b/apps/console/src/components/AppSidebar.tsx @@ -58,7 +58,7 @@ const staticData = { url: "/vendors", icon: ToyBrick, }, - ] + ], }, { title: "Settings", @@ -82,9 +82,9 @@ const staticData = { const AppSidebarQuery = graphql` query AppSidebarQuery { - node(id: "AZSfP_xAcAC5IAAAAAAltA") { + viewer { id - ... on Organization { + organization { name logoUrl createdAt @@ -101,7 +101,7 @@ function AppSidebarContent({ queryRef: PreloadedQuery; }) { const data = usePreloadedQuery(AppSidebarQuery, queryRef); - const organization = data.node; + const organization = data.viewer.organization; return ( diff --git a/apps/console/src/components/__generated__/AppSidebarQuery.graphql.ts b/apps/console/src/components/__generated__/AppSidebarQuery.graphql.ts index 086c3a9ae..e34fc2361 100644 --- a/apps/console/src/components/__generated__/AppSidebarQuery.graphql.ts +++ b/apps/console/src/components/__generated__/AppSidebarQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<578d66fa0d0065452d9fa64611b7cfda>> * @lightSyntaxTransform * @nogrep */ @@ -11,12 +11,14 @@ import { ConcreteRequest } from 'relay-runtime'; export type AppSidebarQuery$variables = Record; export type AppSidebarQuery$data = { - readonly node: { - readonly createdAt?: any; + readonly viewer: { readonly id: string; - readonly logoUrl?: string; - readonly name?: string; - readonly updatedAt?: any; + readonly organization: { + readonly createdAt: any; + readonly logoUrl: string; + readonly name: string; + readonly updatedAt: any; + }; }; }; export type AppSidebarQuery = { @@ -25,54 +27,40 @@ export type AppSidebarQuery = { }; const node: ConcreteRequest = (function(){ -var v0 = [ - { - "kind": "Literal", - "name": "id", - "value": "AZSfP_xAcAC5IAAAAAAltA" - } -], -v1 = { +var v0 = { "alias": null, "args": null, "kind": "ScalarField", "name": "id", "storageKey": null }, +v1 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null +}, v2 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "logoUrl", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "createdAt", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "updatedAt", - "storageKey": null - } - ], - "type": "Organization", - "abstractKey": null + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "logoUrl", + "storageKey": null +}, +v3 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null +}, +v4 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "updatedAt", + "storageKey": null }; return { "fragment": { @@ -83,16 +71,30 @@ return { "selections": [ { "alias": null, - "args": (v0/*: any*/), - "concreteType": null, + "args": null, + "concreteType": "Viewer", "kind": "LinkedField", - "name": "node", + "name": "viewer", "plural": false, "selections": [ - (v1/*: any*/), - (v2/*: any*/) + (v0/*: any*/), + { + "alias": null, + "args": null, + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, + "selections": [ + (v1/*: any*/), + (v2/*: any*/), + (v3/*: any*/), + (v4/*: any*/) + ], + "storageKey": null + } ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + "storageKey": null } ], "type": "Query", @@ -106,37 +108,45 @@ return { "selections": [ { "alias": null, - "args": (v0/*: any*/), - "concreteType": null, + "args": null, + "concreteType": "Viewer", "kind": "LinkedField", - "name": "node", + "name": "viewer", "plural": false, "selections": [ + (v0/*: any*/), { "alias": null, "args": null, - "kind": "ScalarField", - "name": "__typename", + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, + "selections": [ + (v1/*: any*/), + (v2/*: any*/), + (v3/*: any*/), + (v4/*: any*/), + (v0/*: any*/) + ], "storageKey": null - }, - (v1/*: any*/), - (v2/*: any*/) + } ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + "storageKey": null } ] }, "params": { - "cacheID": "c5135cf2fd79365dad2ea581b3e010de", + "cacheID": "e50b9b44daf91d53b07f8912e6c2088f", "id": null, "metadata": {}, "name": "AppSidebarQuery", "operationKind": "query", - "text": "query AppSidebarQuery {\n node(id: \"AZSfP_xAcAC5IAAAAAAltA\") {\n __typename\n id\n ... on Organization {\n name\n logoUrl\n createdAt\n updatedAt\n }\n }\n}\n" + "text": "query AppSidebarQuery {\n viewer {\n id\n organization {\n name\n logoUrl\n createdAt\n updatedAt\n id\n }\n }\n}\n" } }; })(); -(node as any).hash = "2aafa67cfe2e2c748605b224503c7463"; +(node as any).hash = "d450e65862def2f7ebd6f4b8d0475be0"; export default node; diff --git a/apps/console/src/layouts/ConsoleLayout.tsx b/apps/console/src/layouts/ConsoleLayout.tsx index 6807ec76d..93b2f0b76 100644 --- a/apps/console/src/layouts/ConsoleLayout.tsx +++ b/apps/console/src/layouts/ConsoleLayout.tsx @@ -73,7 +73,7 @@ function BreadcrumbFrameworkOverview() { } `, { frameworkId: frameworkId! }, - { fetchPolicy: "store-or-network" }, + { fetchPolicy: "store-or-network" } ); return ( @@ -133,7 +133,7 @@ function BreadcrumbPeopleOverview() { } `, { peopleId: peopleId! }, - { fetchPolicy: "store-or-network" }, + { fetchPolicy: "store-or-network" } ); return ( @@ -177,7 +177,7 @@ function BreadcrumbVendorOverview() { } `, { vendorId: vendorId! }, - { fetchPolicy: "store-or-network" }, + { fetchPolicy: "store-or-network" } ); return ( @@ -215,7 +215,7 @@ function BreadcrumbControlOverview() { } `, { frameworkId: frameworkId!, controlId: controlId! }, - { fetchPolicy: "store-or-network" }, + { fetchPolicy: "store-or-network" } ); return ( diff --git a/apps/console/src/pages/CreatePeoplePage.tsx b/apps/console/src/pages/CreatePeoplePage.tsx index 460d59bd3..fe508d264 100644 --- a/apps/console/src/pages/CreatePeoplePage.tsx +++ b/apps/console/src/pages/CreatePeoplePage.tsx @@ -22,9 +22,11 @@ import { CreatePeoplePageCreatePeopleMutation } from "./__generated__/CreatePeop const createPeoplePageQuery = graphql` query CreatePeoplePageQuery { - currentOrganization: node(id: "AZSfP_xAcAC5IAAAAAAltA") { + viewer { id - ... on Organization { + + organization { + id name } } @@ -111,15 +113,15 @@ function CreatePeoplePageContent({ const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); const peopleConnectionId = ConnectionHandler.getConnectionID( - data.currentOrganization.id, - "PeopleListPage_peoples", + data.viewer.organization.id, + "PeopleListPage_peoples" ); createPeople({ variables: { connections: [peopleConnectionId], input: { - organizationId: data.currentOrganization.id, + organizationId: data.viewer.organization.id, fullName: formData.fullName, primaryEmailAddress: formData.primaryEmailAddress, additionalEmailAddresses: formData.additionalEmailAddresses, @@ -188,7 +190,7 @@ function CreatePeoplePageContent({ newEmails[index] = e.target.value; handleFieldChange( "additionalEmailAddresses", - newEmails, + newEmails ); }} /> @@ -198,11 +200,11 @@ function CreatePeoplePageContent({ onClick={() => { const newEmails = formData.additionalEmailAddresses.filter( - (_, i) => i !== index, + (_, i) => i !== index ); handleFieldChange( "additionalEmailAddresses", - newEmails, + newEmails ); }} > @@ -250,7 +252,7 @@ function CreatePeoplePageContent({ "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 @@ -262,7 +264,7 @@ function CreatePeoplePageContent({ "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 @@ -292,7 +294,7 @@ function CreatePeoplePageContent({ export default function CreatePeoplePage() { const [queryRef, loadQuery] = useQueryLoader( - createPeoplePageQuery, + createPeoplePageQuery ); useEffect(() => { diff --git a/apps/console/src/pages/FrameworkListPage.tsx b/apps/console/src/pages/FrameworkListPage.tsx index 483eeec37..e0aa7c913 100644 --- a/apps/console/src/pages/FrameworkListPage.tsx +++ b/apps/console/src/pages/FrameworkListPage.tsx @@ -9,16 +9,12 @@ import { Card, CardContent } from "@/components/ui/card"; import { Link } from "react-router"; import type { FrameworkListPageQuery as FrameworkListPageQueryType } from "./__generated__/FrameworkListPageQuery.graphql"; import { Helmet } from "react-helmet-async"; -import { Button } from "@/components/ui/button"; -import { Badge } from "@/components/ui/badge"; -import { ChevronRight } from "lucide-react"; -import { Shield } from "lucide-react"; const FrameworkListPageQuery = graphql` query FrameworkListPageQuery { - node(id: "AZSfP_xAcAC5IAAAAAAltA") { + viewer { id - ... on Organization { + organization { frameworks { edges { node { @@ -91,7 +87,7 @@ function FrameworkListPageContent({ }) { const data = usePreloadedQuery(FrameworkListPageQuery, queryRef); const frameworks = - data.node.frameworks?.edges.map((edge) => edge?.node) ?? []; + data.viewer.organization.frameworks?.edges.map((edge) => edge?.node) ?? []; return (
@@ -105,7 +101,7 @@ function FrameworkListPageContent({
{frameworks.map((framework) => { const validatedControls = framework.controls.edges.filter( - (edge) => edge?.node?.state === "IMPLEMENTED", + (edge) => edge?.node?.state === "IMPLEMENTED" ).length; const totalControls = framework.controls.edges.length; @@ -165,7 +161,7 @@ function FrameworkListPageFallback() { export default function FrameworkListPage() { const [queryRef, loadQuery] = useQueryLoader( - FrameworkListPageQuery, + FrameworkListPageQuery ); useEffect(() => { diff --git a/apps/console/src/pages/HomePage.tsx b/apps/console/src/pages/HomePage.tsx index 59a46f62a..bd3e558d5 100644 --- a/apps/console/src/pages/HomePage.tsx +++ b/apps/console/src/pages/HomePage.tsx @@ -10,9 +10,9 @@ import type { HomePageQuery as HomePageQueryType } from "./__generated__/HomePag export const HomePageQuery = graphql` query HomePageQuery { - node(id: "AZSfP_xAcAC5IAAAAAAltA") { + viewer { id - ... on Organization { + organization { name createdAt updatedAt diff --git a/apps/console/src/pages/PeopleListPage.tsx b/apps/console/src/pages/PeopleListPage.tsx index 16dddeabd..2da4efc33 100644 --- a/apps/console/src/pages/PeopleListPage.tsx +++ b/apps/console/src/pages/PeopleListPage.tsx @@ -28,9 +28,9 @@ const peopleListPageQuery = graphql` $last: Int $before: CursorKey ) { - currentOrganization: node(id: "AZSfP_xAcAC5IAAAAAAltA") { + viewer { id - ... on Organization { + organization { ...PeopleListPage_peoples } } @@ -129,7 +129,7 @@ function PeopleListContent({ }) { const data = usePreloadedQuery( peopleListPageQuery, - queryRef, + queryRef ); const [searchParams, setSearchParams] = useSearchParams(); const [isPending, startTransition] = useTransition(); @@ -147,7 +147,7 @@ function PeopleListContent({ } = usePaginationFragment< PeopleListPagePaginationQuery, PeopleListPage_peoples$key - >(peopleListFragment, data.currentOrganization); + >(peopleListFragment, data.viewer.organization); const peoples = peoplesConnection.peoples.edges.map((edge) => edge.node) ?? []; @@ -158,13 +158,19 @@ function PeopleListContent({

Employees

- Keep track of your company's workforce and their progress towards completing tasks assigned to them. + Keep track of your company's workforce and their progress towards + completing tasks assigned to them.

1 people needs to get onboarded

-
- {person?.kind === "EMPLOYEE" ? "Employee" : person?.kind === "CONTRACTOR" - ? "Contractor" - : "Vendor"} + ? "Contractor" + : "Vendor"}
- @@ -316,7 +318,11 @@ function VendorListContent({ className="h-8 w-8 text-muted-foreground hover:bg-transparent [&>svg]:hover:text-destructive" onClick={(e) => { e.preventDefault(); // Prevent navigation - if (window.confirm("Are you sure you want to delete this vendor?")) { + if ( + window.confirm( + "Are you sure you want to delete this vendor?" + ) + ) { deleteVendor({ variables: { connections: [vendorsConnection.vendors.__id], @@ -327,7 +333,8 @@ function VendorListContent({ onCompleted() { toast({ title: "Vendor deleted", - description: "The vendor has been deleted successfully", + description: + "The vendor has been deleted successfully", }); }, }); diff --git a/apps/console/src/pages/__generated__/CreatePeoplePageQuery.graphql.ts b/apps/console/src/pages/__generated__/CreatePeoplePageQuery.graphql.ts index c98707f94..b1d14ee8c 100644 --- a/apps/console/src/pages/__generated__/CreatePeoplePageQuery.graphql.ts +++ b/apps/console/src/pages/__generated__/CreatePeoplePageQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<90c9055cb59db9172002bc02e6e9429d>> + * @generated SignedSource<<25866c1f4e6fb640f91b8d05651df9f4>> * @lightSyntaxTransform * @nogrep */ @@ -11,9 +11,12 @@ import { ConcreteRequest } from 'relay-runtime'; export type CreatePeoplePageQuery$variables = Record; export type CreatePeoplePageQuery$data = { - readonly currentOrganization: { + readonly viewer: { readonly id: string; - readonly name?: string; + readonly organization: { + readonly id: string; + readonly name: string; + }; }; }; export type CreatePeoplePageQuery = { @@ -22,55 +25,53 @@ export type CreatePeoplePageQuery = { }; const node: ConcreteRequest = (function(){ -var v0 = [ - { - "kind": "Literal", - "name": "id", - "value": "AZSfP_xAcAC5IAAAAAAltA" - } -], -v1 = { +var v0 = { "alias": null, "args": null, "kind": "ScalarField", "name": "id", "storageKey": null }, -v2 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - } - ], - "type": "Organization", - "abstractKey": null -}; +v1 = [ + { + "alias": null, + "args": null, + "concreteType": "Viewer", + "kind": "LinkedField", + "name": "viewer", + "plural": false, + "selections": [ + (v0/*: any*/), + { + "alias": null, + "args": null, + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, + "selections": [ + (v0/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + } +]; return { "fragment": { "argumentDefinitions": [], "kind": "Fragment", "metadata": null, "name": "CreatePeoplePageQuery", - "selections": [ - { - "alias": "currentOrganization", - "args": (v0/*: any*/), - "concreteType": null, - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v1/*: any*/), - (v2/*: any*/) - ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" - } - ], + "selections": (v1/*: any*/), "type": "Query", "abstractKey": null }, @@ -79,40 +80,19 @@ return { "argumentDefinitions": [], "kind": "Operation", "name": "CreatePeoplePageQuery", - "selections": [ - { - "alias": "currentOrganization", - "args": (v0/*: any*/), - "concreteType": null, - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null - }, - (v1/*: any*/), - (v2/*: any*/) - ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" - } - ] + "selections": (v1/*: any*/) }, "params": { - "cacheID": "816d745d1a69d598b3507fa4df1e878f", + "cacheID": "e0b72d4317b700564caa46c609276aed", "id": null, "metadata": {}, "name": "CreatePeoplePageQuery", "operationKind": "query", - "text": "query CreatePeoplePageQuery {\n currentOrganization: node(id: \"AZSfP_xAcAC5IAAAAAAltA\") {\n __typename\n id\n ... on Organization {\n name\n }\n }\n}\n" + "text": "query CreatePeoplePageQuery {\n viewer {\n id\n organization {\n id\n name\n }\n }\n}\n" } }; })(); -(node as any).hash = "54148a2bd398d4fda7c72b60c7210e6d"; +(node as any).hash = "89be7e6fd93829bdc8ac374983ca0a9b"; export default node; diff --git a/apps/console/src/pages/__generated__/FrameworkListPageQuery.graphql.ts b/apps/console/src/pages/__generated__/FrameworkListPageQuery.graphql.ts index 9d1cd45b3..48d14fe85 100644 --- a/apps/console/src/pages/__generated__/FrameworkListPageQuery.graphql.ts +++ b/apps/console/src/pages/__generated__/FrameworkListPageQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<87f0a667163355b6f7d273a71aa65a93>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -12,27 +12,29 @@ import { ConcreteRequest } from 'relay-runtime'; export type ControlState = "IMPLEMENTED" | "IN_PROGRESS" | "NOT_APPLICABLE" | "NOT_STARTED"; export type FrameworkListPageQuery$variables = Record; export type FrameworkListPageQuery$data = { - readonly node: { - readonly frameworks?: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly controls: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly id: string; - readonly state: ControlState; - }; - }>; - }; - readonly createdAt: any; - readonly description: string; - readonly id: string; - readonly name: string; - readonly updatedAt: any; - }; - }>; - }; + readonly viewer: { readonly id: string; + readonly organization: { + readonly frameworks: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly controls: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + readonly state: ControlState; + }; + }>; + }; + readonly createdAt: any; + readonly description: string; + readonly id: string; + readonly name: string; + readonly updatedAt: any; + }; + }>; + }; + }; }; }; export type FrameworkListPageQuery = { @@ -41,95 +43,82 @@ export type FrameworkListPageQuery = { }; const node: ConcreteRequest = (function(){ -var v0 = [ - { - "kind": "Literal", - "name": "id", - "value": "AZSfP_xAcAC5IAAAAAAltA" - } -], -v1 = { +var v0 = { "alias": null, "args": null, "kind": "ScalarField", "name": "id", "storageKey": null }, -v2 = { - "kind": "InlineFragment", +v1 = { + "alias": null, + "args": null, + "concreteType": "FrameworkConnection", + "kind": "LinkedField", + "name": "frameworks", + "plural": false, "selections": [ { "alias": null, "args": null, - "concreteType": "FrameworkConnection", + "concreteType": "FrameworkEdge", "kind": "LinkedField", - "name": "frameworks", - "plural": false, + "name": "edges", + "plural": true, "selections": [ { "alias": null, "args": null, - "concreteType": "FrameworkEdge", + "concreteType": "Framework", "kind": "LinkedField", - "name": "edges", - "plural": true, + "name": "node", + "plural": false, "selections": [ + (v0/*: any*/), { "alias": null, "args": null, - "concreteType": "Framework", + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "description", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "ControlConnection", "kind": "LinkedField", - "name": "node", + "name": "controls", "plural": false, "selections": [ - (v1/*: any*/), { "alias": null, "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "description", - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "ControlConnection", + "concreteType": "ControlEdge", "kind": "LinkedField", - "name": "controls", - "plural": false, + "name": "edges", + "plural": true, "selections": [ { "alias": null, "args": null, - "concreteType": "ControlEdge", + "concreteType": "Control", "kind": "LinkedField", - "name": "edges", - "plural": true, + "name": "node", + "plural": false, "selections": [ + (v0/*: any*/), { "alias": null, "args": null, - "concreteType": "Control", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v1/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "state", - "storageKey": null - } - ], + "kind": "ScalarField", + "name": "state", "storageKey": null } ], @@ -137,23 +126,23 @@ v2 = { } ], "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "createdAt", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "updatedAt", - "storageKey": null } ], "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "updatedAt", + "storageKey": null } ], "storageKey": null @@ -162,8 +151,7 @@ v2 = { "storageKey": null } ], - "type": "Organization", - "abstractKey": null + "storageKey": null }; return { "fragment": { @@ -174,16 +162,27 @@ return { "selections": [ { "alias": null, - "args": (v0/*: any*/), - "concreteType": null, + "args": null, + "concreteType": "Viewer", "kind": "LinkedField", - "name": "node", + "name": "viewer", "plural": false, "selections": [ - (v1/*: any*/), - (v2/*: any*/) + (v0/*: any*/), + { + "alias": null, + "args": null, + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, + "selections": [ + (v1/*: any*/) + ], + "storageKey": null + } ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + "storageKey": null } ], "type": "Query", @@ -197,37 +196,42 @@ return { "selections": [ { "alias": null, - "args": (v0/*: any*/), - "concreteType": null, + "args": null, + "concreteType": "Viewer", "kind": "LinkedField", - "name": "node", + "name": "viewer", "plural": false, "selections": [ + (v0/*: any*/), { "alias": null, "args": null, - "kind": "ScalarField", - "name": "__typename", + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, + "selections": [ + (v1/*: any*/), + (v0/*: any*/) + ], "storageKey": null - }, - (v1/*: any*/), - (v2/*: any*/) + } ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + "storageKey": null } ] }, "params": { - "cacheID": "b9f11bd39a99da4a1693b67c60a85845", + "cacheID": "8f573b1a89e302e61a765711c1c6e73a", "id": null, "metadata": {}, "name": "FrameworkListPageQuery", "operationKind": "query", - "text": "query FrameworkListPageQuery {\n node(id: \"AZSfP_xAcAC5IAAAAAAltA\") {\n __typename\n id\n ... on Organization {\n frameworks {\n edges {\n node {\n id\n name\n description\n controls {\n edges {\n node {\n id\n state\n }\n }\n }\n createdAt\n updatedAt\n }\n }\n }\n }\n }\n}\n" + "text": "query FrameworkListPageQuery {\n viewer {\n id\n organization {\n frameworks {\n edges {\n node {\n id\n name\n description\n controls {\n edges {\n node {\n id\n state\n }\n }\n }\n createdAt\n updatedAt\n }\n }\n }\n id\n }\n }\n}\n" } }; })(); -(node as any).hash = "cc761cbab629daf0587a9befff255256"; +(node as any).hash = "ac0337411177ab9b1c8ef81e6bb47a06"; export default node; diff --git a/apps/console/src/pages/__generated__/HomePageQuery.graphql.ts b/apps/console/src/pages/__generated__/HomePageQuery.graphql.ts index 5c41b063c..cad08a8ff 100644 --- a/apps/console/src/pages/__generated__/HomePageQuery.graphql.ts +++ b/apps/console/src/pages/__generated__/HomePageQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<77e7a845bc8d788287f50a2f97600987>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -14,114 +14,116 @@ export type EvidenceState = "EXPIRED" | "INVALID" | "VALID"; export type TaskState = "DONE" | "TODO"; export type HomePageQuery$variables = Record; export type HomePageQuery$data = { - readonly node: { - readonly createdAt?: any; - readonly frameworks?: { - readonly edges: ReadonlyArray<{ - readonly cursor: any; - readonly node: { - readonly controls: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly id: string; - readonly name: string; - readonly state: ControlState; - readonly stateTransisions: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly createdAt: any; - readonly fromState: ControlState | null | undefined; - readonly id: string; - readonly toState: ControlState; - readonly updatedAt: any; - }; - }>; - }; - readonly tasks: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly createdAt: any; - readonly evidences: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly createdAt: any; - readonly fileUrl: string; - readonly id: string; - readonly state: EvidenceState; - readonly stateTransisions: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly createdAt: any; - readonly fromState: EvidenceState | null | undefined; - readonly id: string; - readonly reason: string | null | undefined; - readonly toState: EvidenceState; - readonly updatedAt: any; - }; - }>; - }; - readonly updatedAt: any; - }; - }>; - }; - readonly id: string; - readonly name: string; - readonly state: TaskState; - readonly stateTransisions: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly createdAt: any; - readonly fromState: TaskState | null | undefined; - readonly id: string; - readonly reason: string | null | undefined; - readonly toState: TaskState; - readonly updatedAt: any; - }; - }>; - }; - readonly updatedAt: any; - }; - }>; - }; - }; - }>; - }; - readonly description: string; - readonly id: string; - readonly name: string; - }; - }>; - readonly pageInfo: { - readonly endCursor: any | null | undefined; - readonly hasNextPage: boolean; - readonly hasPreviousPage: boolean; - readonly startCursor: any | null | undefined; - }; - }; + readonly viewer: { readonly id: string; - readonly name?: string; - readonly peoples?: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly additionalEmailAddresses: ReadonlyArray; - readonly createdAt: any; - readonly fullName: string; - readonly id: string; - readonly primaryEmailAddress: string; - readonly updatedAt: any; + readonly organization: { + readonly createdAt: any; + readonly frameworks: { + readonly edges: ReadonlyArray<{ + readonly cursor: any; + readonly node: { + readonly controls: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + readonly name: string; + readonly state: ControlState; + readonly stateTransisions: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly createdAt: any; + readonly fromState: ControlState | null | undefined; + readonly id: string; + readonly toState: ControlState; + readonly updatedAt: any; + }; + }>; + }; + readonly tasks: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly createdAt: any; + readonly evidences: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly createdAt: any; + readonly fileUrl: string; + readonly id: string; + readonly state: EvidenceState; + readonly stateTransisions: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly createdAt: any; + readonly fromState: EvidenceState | null | undefined; + readonly id: string; + readonly reason: string | null | undefined; + readonly toState: EvidenceState; + readonly updatedAt: any; + }; + }>; + }; + readonly updatedAt: any; + }; + }>; + }; + readonly id: string; + readonly name: string; + readonly state: TaskState; + readonly stateTransisions: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly createdAt: any; + readonly fromState: TaskState | null | undefined; + readonly id: string; + readonly reason: string | null | undefined; + readonly toState: TaskState; + readonly updatedAt: any; + }; + }>; + }; + readonly updatedAt: any; + }; + }>; + }; + }; + }>; + }; + readonly description: string; + readonly id: string; + readonly name: string; + }; + }>; + readonly pageInfo: { + readonly endCursor: any | null | undefined; + readonly hasNextPage: boolean; + readonly hasPreviousPage: boolean; + readonly startCursor: any | null | undefined; }; - }>; - }; - readonly updatedAt?: any; - readonly vendors?: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly createdAt: any; - readonly id: string; - readonly name: string; - readonly updatedAt: any; - }; - }>; + }; + readonly name: string; + readonly peoples: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly additionalEmailAddresses: ReadonlyArray; + readonly createdAt: any; + readonly fullName: string; + readonly id: string; + readonly primaryEmailAddress: string; + readonly updatedAt: any; + }; + }>; + }; + readonly updatedAt: any; + readonly vendors: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly createdAt: any; + readonly id: string; + readonly name: string; + readonly updatedAt: any; + }; + }>; + }; }; }; }; @@ -131,467 +133,451 @@ export type HomePageQuery = { }; const node: ConcreteRequest = (function(){ -var v0 = [ - { - "kind": "Literal", - "name": "id", - "value": "AZSfP_xAcAC5IAAAAAAltA" - } -], -v1 = { +var v0 = { "alias": null, "args": null, "kind": "ScalarField", "name": "id", "storageKey": null }, -v2 = { +v1 = { "alias": null, "args": null, "kind": "ScalarField", "name": "name", "storageKey": null }, -v3 = { +v2 = { "alias": null, "args": null, "kind": "ScalarField", "name": "createdAt", "storageKey": null }, -v4 = { +v3 = { "alias": null, "args": null, "kind": "ScalarField", "name": "updatedAt", "storageKey": null }, +v4 = { + "alias": null, + "args": null, + "concreteType": "VendorConnection", + "kind": "LinkedField", + "name": "vendors", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "VendorEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Vendor", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v0/*: any*/), + (v1/*: any*/), + (v2/*: any*/), + (v3/*: any*/) + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null +}, v5 = { "alias": null, "args": null, - "kind": "ScalarField", - "name": "state", + "concreteType": "PeopleConnection", + "kind": "LinkedField", + "name": "peoples", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "PeopleEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "People", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v0/*: any*/), + { + "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 + }, + (v2/*: any*/), + (v3/*: any*/) + ], + "storageKey": null + } + ], + "storageKey": null + } + ], "storageKey": null }, v6 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "toState", + "name": "state", "storageKey": null }, v7 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "fromState", + "name": "toState", "storageKey": null }, v8 = { "alias": null, "args": null, "kind": "ScalarField", - "name": "reason", + "name": "fromState", "storageKey": null }, v9 = { - "kind": "InlineFragment", + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "reason", + "storageKey": null +}, +v10 = { + "alias": null, + "args": null, + "concreteType": "FrameworkConnection", + "kind": "LinkedField", + "name": "frameworks", + "plural": false, "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v4/*: any*/), { "alias": null, "args": null, - "concreteType": "VendorConnection", + "concreteType": "PageInfo", "kind": "LinkedField", - "name": "vendors", + "name": "pageInfo", "plural": false, "selections": [ { "alias": null, "args": null, - "concreteType": "VendorEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "Vendor", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v1/*: any*/), - (v2/*: any*/), - (v3/*: any*/), - (v4/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "PeopleConnection", - "kind": "LinkedField", - "name": "peoples", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "PeopleEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "People", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v1/*: any*/), - { - "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 - }, - (v3/*: any*/), - (v4/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "FrameworkConnection", - "kind": "LinkedField", - "name": "frameworks", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "PageInfo", - "kind": "LinkedField", - "name": "pageInfo", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasNextPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasPreviousPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "startCursor", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "endCursor", - "storageKey": null - } - ], + "kind": "ScalarField", + "name": "hasNextPage", "storageKey": null }, { "alias": null, "args": null, - "concreteType": "FrameworkEdge", + "kind": "ScalarField", + "name": "hasPreviousPage", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "startCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "FrameworkEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "Framework", "kind": "LinkedField", - "name": "edges", - "plural": true, + "name": "node", + "plural": false, "selections": [ + (v0/*: any*/), + (v1/*: any*/), { "alias": null, "args": null, "kind": "ScalarField", - "name": "cursor", + "name": "description", "storageKey": null }, { "alias": null, "args": null, - "concreteType": "Framework", + "concreteType": "ControlConnection", "kind": "LinkedField", - "name": "node", + "name": "controls", "plural": false, "selections": [ - (v1/*: any*/), - (v2/*: any*/), { "alias": null, "args": null, - "kind": "ScalarField", - "name": "description", - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "ControlConnection", + "concreteType": "ControlEdge", "kind": "LinkedField", - "name": "controls", - "plural": false, + "name": "edges", + "plural": true, "selections": [ { "alias": null, "args": null, - "concreteType": "ControlEdge", + "concreteType": "Control", "kind": "LinkedField", - "name": "edges", - "plural": true, + "name": "node", + "plural": false, "selections": [ + (v0/*: any*/), + (v1/*: any*/), + (v6/*: any*/), { "alias": null, "args": null, - "concreteType": "Control", + "concreteType": "ControlStateTransitionConnection", "kind": "LinkedField", - "name": "node", + "name": "stateTransisions", "plural": false, "selections": [ - (v1/*: any*/), - (v2/*: any*/), - (v5/*: any*/), { "alias": null, "args": null, - "concreteType": "ControlStateTransitionConnection", + "concreteType": "ControlStateTransitionEdge", "kind": "LinkedField", - "name": "stateTransisions", - "plural": false, + "name": "edges", + "plural": true, "selections": [ { "alias": null, "args": null, - "concreteType": "ControlStateTransitionEdge", + "concreteType": "ControlStateTransition", "kind": "LinkedField", - "name": "edges", - "plural": true, + "name": "node", + "plural": false, "selections": [ - { - "alias": null, - "args": null, - "concreteType": "ControlStateTransition", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v1/*: any*/), - (v6/*: any*/), - (v7/*: any*/), - (v3/*: any*/), - (v4/*: any*/) - ], - "storageKey": null - } + (v0/*: any*/), + (v7/*: any*/), + (v8/*: any*/), + (v2/*: any*/), + (v3/*: any*/) ], "storageKey": null } ], "storageKey": null - }, + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "TaskConnection", + "kind": "LinkedField", + "name": "tasks", + "plural": false, + "selections": [ { "alias": null, "args": null, - "concreteType": "TaskConnection", + "concreteType": "TaskEdge", "kind": "LinkedField", - "name": "tasks", - "plural": false, + "name": "edges", + "plural": true, "selections": [ { "alias": null, "args": null, - "concreteType": "TaskEdge", + "concreteType": "Task", "kind": "LinkedField", - "name": "edges", - "plural": true, + "name": "node", + "plural": false, "selections": [ + (v0/*: any*/), + (v1/*: any*/), + (v6/*: any*/), { "alias": null, "args": null, - "concreteType": "Task", + "concreteType": "EvidenceConnection", "kind": "LinkedField", - "name": "node", + "name": "evidences", "plural": false, "selections": [ - (v1/*: any*/), - (v2/*: any*/), - (v5/*: any*/), { "alias": null, "args": null, - "concreteType": "EvidenceConnection", + "concreteType": "EvidenceEdge", "kind": "LinkedField", - "name": "evidences", - "plural": false, + "name": "edges", + "plural": true, "selections": [ { "alias": null, "args": null, - "concreteType": "EvidenceEdge", + "concreteType": "Evidence", "kind": "LinkedField", - "name": "edges", - "plural": true, + "name": "node", + "plural": false, "selections": [ + (v0/*: any*/), + (v6/*: any*/), { "alias": null, "args": null, - "concreteType": "Evidence", + "kind": "ScalarField", + "name": "fileUrl", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "EvidenceStateTransitionConnection", "kind": "LinkedField", - "name": "node", + "name": "stateTransisions", "plural": false, "selections": [ - (v1/*: any*/), - (v5/*: any*/), { "alias": null, "args": null, - "kind": "ScalarField", - "name": "fileUrl", - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "EvidenceStateTransitionConnection", + "concreteType": "EvidenceStateTransitionEdge", "kind": "LinkedField", - "name": "stateTransisions", - "plural": false, + "name": "edges", + "plural": true, "selections": [ { "alias": null, "args": null, - "concreteType": "EvidenceStateTransitionEdge", + "concreteType": "EvidenceStateTransition", "kind": "LinkedField", - "name": "edges", - "plural": true, + "name": "node", + "plural": false, "selections": [ - { - "alias": null, - "args": null, - "concreteType": "EvidenceStateTransition", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v1/*: any*/), - (v7/*: any*/), - (v6/*: any*/), - (v8/*: any*/), - (v3/*: any*/), - (v4/*: any*/) - ], - "storageKey": null - } + (v0/*: any*/), + (v8/*: any*/), + (v7/*: any*/), + (v9/*: any*/), + (v2/*: any*/), + (v3/*: any*/) ], "storageKey": null } ], "storageKey": null - }, - (v3/*: any*/), - (v4/*: any*/) + } ], "storageKey": null - } + }, + (v2/*: any*/), + (v3/*: any*/) ], "storageKey": null } ], "storageKey": null - }, + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "TaskStateTransitionConnection", + "kind": "LinkedField", + "name": "stateTransisions", + "plural": false, + "selections": [ { "alias": null, "args": null, - "concreteType": "TaskStateTransitionConnection", + "concreteType": "TaskStateTransitionEdge", "kind": "LinkedField", - "name": "stateTransisions", - "plural": false, + "name": "edges", + "plural": true, "selections": [ { "alias": null, "args": null, - "concreteType": "TaskStateTransitionEdge", + "concreteType": "TaskStateTransition", "kind": "LinkedField", - "name": "edges", - "plural": true, + "name": "node", + "plural": false, "selections": [ - { - "alias": null, - "args": null, - "concreteType": "TaskStateTransition", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v1/*: any*/), - (v6/*: any*/), - (v7/*: any*/), - (v8/*: any*/), - (v3/*: any*/), - (v4/*: any*/) - ], - "storageKey": null - } + (v0/*: any*/), + (v7/*: any*/), + (v8/*: any*/), + (v9/*: any*/), + (v2/*: any*/), + (v3/*: any*/) ], "storageKey": null } ], "storageKey": null - }, - (v3/*: any*/), - (v4/*: any*/) + } ], "storageKey": null - } + }, + (v2/*: any*/), + (v3/*: any*/) ], "storageKey": null } @@ -617,8 +603,7 @@ v9 = { "storageKey": null } ], - "type": "Organization", - "abstractKey": null + "storageKey": null }; return { "fragment": { @@ -629,16 +614,32 @@ return { "selections": [ { "alias": null, - "args": (v0/*: any*/), - "concreteType": null, + "args": null, + "concreteType": "Viewer", "kind": "LinkedField", - "name": "node", + "name": "viewer", "plural": false, "selections": [ - (v1/*: any*/), - (v9/*: any*/) + (v0/*: any*/), + { + "alias": null, + "args": null, + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, + "selections": [ + (v1/*: any*/), + (v2/*: any*/), + (v3/*: any*/), + (v4/*: any*/), + (v5/*: any*/), + (v10/*: any*/) + ], + "storageKey": null + } ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + "storageKey": null } ], "type": "Query", @@ -652,37 +653,47 @@ return { "selections": [ { "alias": null, - "args": (v0/*: any*/), - "concreteType": null, + "args": null, + "concreteType": "Viewer", "kind": "LinkedField", - "name": "node", + "name": "viewer", "plural": false, "selections": [ + (v0/*: any*/), { "alias": null, "args": null, - "kind": "ScalarField", - "name": "__typename", + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, + "selections": [ + (v1/*: any*/), + (v2/*: any*/), + (v3/*: any*/), + (v4/*: any*/), + (v5/*: any*/), + (v10/*: any*/), + (v0/*: any*/) + ], "storageKey": null - }, - (v1/*: any*/), - (v9/*: any*/) + } ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + "storageKey": null } ] }, "params": { - "cacheID": "c73dd7150596d3c0f5a6182fa68bbdc7", + "cacheID": "9f8dd0b1a2698dd2d944e75de5d32087", "id": null, "metadata": {}, "name": "HomePageQuery", "operationKind": "query", - "text": "query HomePageQuery {\n node(id: \"AZSfP_xAcAC5IAAAAAAltA\") {\n __typename\n id\n ... on Organization {\n name\n createdAt\n updatedAt\n vendors {\n edges {\n node {\n id\n name\n createdAt\n updatedAt\n }\n }\n }\n peoples {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n additionalEmailAddresses\n createdAt\n updatedAt\n }\n }\n }\n frameworks {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n name\n description\n controls {\n edges {\n node {\n id\n name\n state\n stateTransisions {\n edges {\n node {\n id\n toState\n fromState\n createdAt\n updatedAt\n }\n }\n }\n tasks {\n edges {\n node {\n id\n name\n state\n evidences {\n edges {\n node {\n id\n state\n fileUrl\n stateTransisions {\n edges {\n node {\n id\n fromState\n toState\n reason\n createdAt\n updatedAt\n }\n }\n }\n createdAt\n updatedAt\n }\n }\n }\n stateTransisions {\n edges {\n node {\n id\n toState\n fromState\n reason\n createdAt\n updatedAt\n }\n }\n }\n createdAt\n updatedAt\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n }\n}\n" + "text": "query HomePageQuery {\n viewer {\n id\n organization {\n name\n createdAt\n updatedAt\n vendors {\n edges {\n node {\n id\n name\n createdAt\n updatedAt\n }\n }\n }\n peoples {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n additionalEmailAddresses\n createdAt\n updatedAt\n }\n }\n }\n frameworks {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n edges {\n cursor\n node {\n id\n name\n description\n controls {\n edges {\n node {\n id\n name\n state\n stateTransisions {\n edges {\n node {\n id\n toState\n fromState\n createdAt\n updatedAt\n }\n }\n }\n tasks {\n edges {\n node {\n id\n name\n state\n evidences {\n edges {\n node {\n id\n state\n fileUrl\n stateTransisions {\n edges {\n node {\n id\n fromState\n toState\n reason\n createdAt\n updatedAt\n }\n }\n }\n createdAt\n updatedAt\n }\n }\n }\n stateTransisions {\n edges {\n node {\n id\n toState\n fromState\n reason\n createdAt\n updatedAt\n }\n }\n }\n createdAt\n updatedAt\n }\n }\n }\n }\n }\n }\n }\n }\n }\n id\n }\n }\n}\n" } }; })(); -(node as any).hash = "8ecbd457d85e0552b610b3942cc0c228"; +(node as any).hash = "875e681cb7e936d3f1a543e88c4cb2d0"; export default node; diff --git a/apps/console/src/pages/__generated__/PeopleListPageQuery.graphql.ts b/apps/console/src/pages/__generated__/PeopleListPageQuery.graphql.ts index 7eca66249..193269616 100644 --- a/apps/console/src/pages/__generated__/PeopleListPageQuery.graphql.ts +++ b/apps/console/src/pages/__generated__/PeopleListPageQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<7a16966c3cf3d76ae51330e5536df480>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -17,9 +17,11 @@ export type PeopleListPageQuery$variables = { last?: number | null | undefined; }; export type PeopleListPageQuery$data = { - readonly currentOrganization: { + readonly viewer: { readonly id: string; - readonly " $fragmentSpreads": FragmentRefs<"PeopleListPage_peoples">; + readonly organization: { + readonly " $fragmentSpreads": FragmentRefs<"PeopleListPage_peoples">; + }; }; }; export type PeopleListPageQuery = { @@ -48,28 +50,14 @@ v3 = { "kind": "LocalArgument", "name": "last" }, -v4 = [ - { - "kind": "Literal", - "name": "id", - "value": "AZSfP_xAcAC5IAAAAAAltA" - } -], -v5 = { +v4 = { "alias": null, "args": null, "kind": "ScalarField", "name": "id", "storageKey": null }, -v6 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null -}, -v7 = [ +v5 = [ { "kind": "Variable", "name": "after", @@ -104,16 +92,21 @@ return { "name": "PeopleListPageQuery", "selections": [ { - "alias": "currentOrganization", - "args": (v4/*: any*/), - "concreteType": null, + "alias": null, + "args": null, + "concreteType": "Viewer", "kind": "LinkedField", - "name": "node", + "name": "viewer", "plural": false, "selections": [ - (v5/*: any*/), + (v4/*: any*/), { - "kind": "InlineFragment", + "alias": null, + "args": null, + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, "selections": [ { "args": null, @@ -121,11 +114,10 @@ return { "name": "PeopleListPage_peoples" } ], - "type": "Organization", - "abstractKey": null + "storageKey": null } ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + "storageKey": null } ], "type": "Query", @@ -143,21 +135,26 @@ return { "name": "PeopleListPageQuery", "selections": [ { - "alias": "currentOrganization", - "args": (v4/*: any*/), - "concreteType": null, + "alias": null, + "args": null, + "concreteType": "Viewer", "kind": "LinkedField", - "name": "node", + "name": "viewer", "plural": false, "selections": [ - (v6/*: any*/), - (v5/*: any*/), + (v4/*: any*/), { - "kind": "InlineFragment", + "alias": null, + "args": null, + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, "selections": [ + (v4/*: any*/), { "alias": null, - "args": (v7/*: any*/), + "args": (v5/*: any*/), "concreteType": "PeopleConnection", "kind": "LinkedField", "name": "peoples", @@ -179,7 +176,7 @@ return { "name": "node", "plural": false, "selections": [ - (v5/*: any*/), + (v4/*: any*/), { "alias": null, "args": null, @@ -222,7 +219,13 @@ return { "name": "updatedAt", "storageKey": null }, - (v6/*: any*/) + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + } ], "storageKey": null }, @@ -292,7 +295,7 @@ return { }, { "alias": null, - "args": (v7/*: any*/), + "args": (v5/*: any*/), "filters": null, "handle": "connection", "key": "PeopleListPage_peoples", @@ -300,25 +303,24 @@ return { "name": "peoples" } ], - "type": "Organization", - "abstractKey": null + "storageKey": null } ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + "storageKey": null } ] }, "params": { - "cacheID": "99597791fe9f240b902affc3d5e63af6", + "cacheID": "d9b0af5656fcb50e2cedf0f831c0394d", "id": null, "metadata": {}, "name": "PeopleListPageQuery", "operationKind": "query", - "text": "query PeopleListPageQuery(\n $first: Int\n $after: CursorKey\n $last: Int\n $before: CursorKey\n) {\n currentOrganization: node(id: \"AZSfP_xAcAC5IAAAAAAltA\") {\n __typename\n id\n ... on Organization {\n ...PeopleListPage_peoples\n }\n }\n}\n\nfragment PeopleListPage_peoples on Organization {\n id\n peoples(first: $first, after: $after, last: $last, before: $before) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n additionalEmailAddresses\n kind\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n }\n}\n" + "text": "query PeopleListPageQuery(\n $first: Int\n $after: CursorKey\n $last: Int\n $before: CursorKey\n) {\n viewer {\n id\n organization {\n ...PeopleListPage_peoples\n id\n }\n }\n}\n\nfragment PeopleListPage_peoples on Organization {\n id\n peoples(first: $first, after: $after, last: $last, before: $before) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n additionalEmailAddresses\n kind\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n }\n}\n" } }; })(); -(node as any).hash = "f9f133aa09d9d051cef5697aba2398c5"; +(node as any).hash = "9646de6e2d6b844cb87945b8a26c0999"; export default node; diff --git a/apps/console/src/pages/__generated__/SettingsPageQuery.graphql.ts b/apps/console/src/pages/__generated__/SettingsPageQuery.graphql.ts index ee87c0ace..8e8a801d7 100644 --- a/apps/console/src/pages/__generated__/SettingsPageQuery.graphql.ts +++ b/apps/console/src/pages/__generated__/SettingsPageQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<1daa3e6f3ef43392ed73ce9ddb46aa47>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -11,10 +11,12 @@ import { ConcreteRequest } from 'relay-runtime'; export type SettingsPageQuery$variables = Record; export type SettingsPageQuery$data = { - readonly node: { + readonly viewer: { readonly id: string; - readonly logoUrl?: string; - readonly name?: string; + readonly organization: { + readonly logoUrl: string; + readonly name: string; + }; }; }; export type SettingsPageQuery = { @@ -23,40 +25,26 @@ export type SettingsPageQuery = { }; const node: ConcreteRequest = (function(){ -var v0 = [ - { - "kind": "Literal", - "name": "id", - "value": "AZSfP_xAcAC5IAAAAAAltA" - } -], -v1 = { +var v0 = { "alias": null, "args": null, "kind": "ScalarField", "name": "id", "storageKey": null }, +v1 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null +}, v2 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "logoUrl", - "storageKey": null - } - ], - "type": "Organization", - "abstractKey": null + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "logoUrl", + "storageKey": null }; return { "fragment": { @@ -67,16 +55,28 @@ return { "selections": [ { "alias": null, - "args": (v0/*: any*/), - "concreteType": null, + "args": null, + "concreteType": "Viewer", "kind": "LinkedField", - "name": "node", + "name": "viewer", "plural": false, "selections": [ - (v1/*: any*/), - (v2/*: any*/) + (v0/*: any*/), + { + "alias": null, + "args": null, + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, + "selections": [ + (v1/*: any*/), + (v2/*: any*/) + ], + "storageKey": null + } ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + "storageKey": null } ], "type": "Query", @@ -90,37 +90,43 @@ return { "selections": [ { "alias": null, - "args": (v0/*: any*/), - "concreteType": null, + "args": null, + "concreteType": "Viewer", "kind": "LinkedField", - "name": "node", + "name": "viewer", "plural": false, "selections": [ + (v0/*: any*/), { "alias": null, "args": null, - "kind": "ScalarField", - "name": "__typename", + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, + "selections": [ + (v1/*: any*/), + (v2/*: any*/), + (v0/*: any*/) + ], "storageKey": null - }, - (v1/*: any*/), - (v2/*: any*/) + } ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + "storageKey": null } ] }, "params": { - "cacheID": "911c50f40d00159bd8201b7193fe6686", + "cacheID": "77d3f8660df07b02aa515461c9ec1449", "id": null, "metadata": {}, "name": "SettingsPageQuery", "operationKind": "query", - "text": "query SettingsPageQuery {\n node(id: \"AZSfP_xAcAC5IAAAAAAltA\") {\n __typename\n id\n ... on Organization {\n name\n logoUrl\n }\n }\n}\n" + "text": "query SettingsPageQuery {\n viewer {\n id\n organization {\n name\n logoUrl\n id\n }\n }\n}\n" } }; })(); -(node as any).hash = "fc0474b3b161e0a1e6c41f9898afa5b0"; +(node as any).hash = "c639e9c45b175beec64550bb72fe5111"; export default node; diff --git a/apps/console/src/pages/__generated__/VendorListPageQuery.graphql.ts b/apps/console/src/pages/__generated__/VendorListPageQuery.graphql.ts index d93948fa5..be1c6e556 100644 --- a/apps/console/src/pages/__generated__/VendorListPageQuery.graphql.ts +++ b/apps/console/src/pages/__generated__/VendorListPageQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<65ad922b0229a2d1840687c46d5cea29>> + * @generated SignedSource<<4b2d9a3c1a701053fe929da59580308b>> * @lightSyntaxTransform * @nogrep */ @@ -17,9 +17,11 @@ export type VendorListPageQuery$variables = { last?: number | null | undefined; }; export type VendorListPageQuery$data = { - readonly currentOrganization: { + readonly viewer: { readonly id: string; - readonly " $fragmentSpreads": FragmentRefs<"VendorListPage_vendors">; + readonly organization: { + readonly " $fragmentSpreads": FragmentRefs<"VendorListPage_vendors">; + }; }; }; export type VendorListPageQuery = { @@ -48,28 +50,14 @@ v3 = { "kind": "LocalArgument", "name": "last" }, -v4 = [ - { - "kind": "Literal", - "name": "id", - "value": "AZSfP_xAcAC5IAAAAAAltA" - } -], -v5 = { +v4 = { "alias": null, "args": null, "kind": "ScalarField", "name": "id", "storageKey": null }, -v6 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null -}, -v7 = [ +v5 = [ { "kind": "Variable", "name": "after", @@ -104,16 +92,21 @@ return { "name": "VendorListPageQuery", "selections": [ { - "alias": "currentOrganization", - "args": (v4/*: any*/), - "concreteType": null, + "alias": null, + "args": null, + "concreteType": "Viewer", "kind": "LinkedField", - "name": "node", + "name": "viewer", "plural": false, "selections": [ - (v5/*: any*/), + (v4/*: any*/), { - "kind": "InlineFragment", + "alias": null, + "args": null, + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, "selections": [ { "args": null, @@ -121,11 +114,10 @@ return { "name": "VendorListPage_vendors" } ], - "type": "Organization", - "abstractKey": null + "storageKey": null } ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + "storageKey": null } ], "type": "Query", @@ -143,21 +135,26 @@ return { "name": "VendorListPageQuery", "selections": [ { - "alias": "currentOrganization", - "args": (v4/*: any*/), - "concreteType": null, + "alias": null, + "args": null, + "concreteType": "Viewer", "kind": "LinkedField", - "name": "node", + "name": "viewer", "plural": false, "selections": [ - (v6/*: any*/), - (v5/*: any*/), + (v4/*: any*/), { - "kind": "InlineFragment", + "alias": null, + "args": null, + "concreteType": "Organization", + "kind": "LinkedField", + "name": "organization", + "plural": false, "selections": [ + (v4/*: any*/), { "alias": null, - "args": (v7/*: any*/), + "args": (v5/*: any*/), "concreteType": "VendorConnection", "kind": "LinkedField", "name": "vendors", @@ -179,7 +176,7 @@ return { "name": "node", "plural": false, "selections": [ - (v5/*: any*/), + (v4/*: any*/), { "alias": null, "args": null, @@ -208,7 +205,13 @@ return { "name": "updatedAt", "storageKey": null }, - (v6/*: any*/) + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + } ], "storageKey": null }, @@ -278,7 +281,7 @@ return { }, { "alias": null, - "args": (v7/*: any*/), + "args": (v5/*: any*/), "filters": null, "handle": "connection", "key": "VendorListPage_vendors", @@ -286,25 +289,24 @@ return { "name": "vendors" } ], - "type": "Organization", - "abstractKey": null + "storageKey": null } ], - "storageKey": "node(id:\"AZSfP_xAcAC5IAAAAAAltA\")" + "storageKey": null } ] }, "params": { - "cacheID": "8150b3303765174bbf41ebf4cd12534c", + "cacheID": "0c3f0f24d810d8a510fa30ca3f3f5890", "id": null, "metadata": {}, "name": "VendorListPageQuery", "operationKind": "query", - "text": "query VendorListPageQuery(\n $first: Int\n $after: CursorKey\n $last: Int\n $before: CursorKey\n) {\n currentOrganization: node(id: \"AZSfP_xAcAC5IAAAAAAltA\") {\n __typename\n id\n ... on Organization {\n ...VendorListPage_vendors\n }\n }\n}\n\nfragment VendorListPage_vendors on Organization {\n id\n vendors(first: $first, after: $after, last: $last, before: $before) {\n edges {\n node {\n id\n name\n description\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n }\n}\n" + "text": "query VendorListPageQuery(\n $first: Int\n $after: CursorKey\n $last: Int\n $before: CursorKey\n) {\n viewer {\n id\n organization {\n ...VendorListPage_vendors\n id\n }\n }\n}\n\nfragment VendorListPage_vendors on Organization {\n id\n vendors(first: $first, after: $after, last: $last, before: $before) {\n edges {\n node {\n id\n name\n description\n createdAt\n updatedAt\n __typename\n }\n cursor\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n }\n}\n" } }; })(); -(node as any).hash = "a1f88bf5287abaffb051993051d0e2a7"; +(node as any).hash = "ffd0aaecc51a29f19ff874adbb38dab4"; export default node; diff --git a/pkg/api/console/v1/schema.graphql b/pkg/api/console/v1/schema.graphql index e295ad1e7..b392d42b4 100644 --- a/pkg/api/console/v1/schema.graphql +++ b/pkg/api/console/v1/schema.graphql @@ -5,13 +5,11 @@ directive @goField( ) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION directive @goModel( - model: String - models: [String!] + model: String + models: [String!] ) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION -directive @goEnum( - value: String -) on ENUM_VALUE +directive @goEnum(value: String) on ENUM_VALUE scalar CursorKey scalar Void @@ -22,27 +20,62 @@ interface Node { id: ID! } -enum ControlState @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.ControlState") { - NOT_STARTED @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateNotStarted") - IN_PROGRESS @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateInProgress") - NOT_APPLICABLE @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateNotApplicable") - IMPLEMENTED @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateImplemented") +enum ControlState + @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.ControlState") { + NOT_STARTED + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateNotStarted" + ) + IN_PROGRESS + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateInProgress" + ) + NOT_APPLICABLE + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateNotApplicable" + ) + IMPLEMENTED + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateImplemented" + ) } -enum TaskState @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.TaskState") { - TODO @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.TaskStateTodo") - DONE @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.TaskStateDone") +enum TaskState + @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.TaskState") { + TODO + @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.TaskStateTodo") + DONE + @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.TaskStateDone") } -enum EvidenceState @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceState") { - VALID @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceStateValid") - INVALID @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceStateInvalid") - EXPIRED @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceStateExpired") +enum EvidenceState + @goModel( + model: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceState" + ) { + VALID + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceStateValid" + ) + INVALID + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceStateInvalid" + ) + EXPIRED + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceStateExpired" + ) } -enum PeopleKind @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKind") { - EMPLOYEE @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindEmployee") - CONTRACTOR @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindContractor") +enum PeopleKind + @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKind") { + EMPLOYEE + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindEmployee" + ) + CONTRACTOR + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindContractor" + ) } type PageInfo { @@ -238,7 +271,7 @@ type Task implements Node { last: Int before: CursorKey ): EvidenceConnection! @goField(forceResolver: true) - + createdAt: Datetime! updatedAt: Datetime! } @@ -311,6 +344,12 @@ type EvidenceStateTransition { type Query { node(id: ID!): Node! + viewer: Viewer! +} + +type Viewer { + id: ID! + organization: Organization! @goField(forceResolver: true) } type Mutation { @@ -360,16 +399,38 @@ input UpdatePeopleInput { kind: PeopleKind } -enum ServiceCriticality @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticality") { - LOW @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticalityLow") - MEDIUM @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticalityMedium") - HIGH @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticalityHigh") +enum ServiceCriticality + @goModel( + model: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticality" + ) { + LOW + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticalityLow" + ) + MEDIUM + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticalityMedium" + ) + HIGH + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticalityHigh" + ) } -enum RiskTier @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.RiskTier") { - CRITICAL @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.RiskTierCritical") - SIGNIFICANT @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.RiskTierSignificant") - GENERAL @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.RiskTierGeneral") +enum RiskTier + @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.RiskTier") { + CRITICAL + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.RiskTierCritical" + ) + SIGNIFICANT + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.RiskTierSignificant" + ) + GENERAL + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.RiskTierGeneral" + ) } input UpdateVendorInput { diff --git a/pkg/api/console/v1/schema/schema.go b/pkg/api/console/v1/schema/schema.go index b0e9b9c28..c3bdd9a43 100644 --- a/pkg/api/console/v1/schema/schema.go +++ b/pkg/api/console/v1/schema/schema.go @@ -49,6 +49,7 @@ type ResolverRoot interface { Organization() OrganizationResolver Query() QueryResolver Task() TaskResolver + Viewer() ViewerResolver } type DirectiveRoot struct { @@ -220,7 +221,8 @@ type ComplexityRoot struct { } Query struct { - Node func(childComplexity int, id gid.GID) int + Node func(childComplexity int, id gid.GID) int + Viewer func(childComplexity int) int } Task struct { @@ -288,6 +290,11 @@ type ComplexityRoot struct { Cursor func(childComplexity int) int Node func(childComplexity int) int } + + Viewer struct { + ID func(childComplexity int) int + Organization func(childComplexity int) int + } } type ControlResolver interface { @@ -315,11 +322,15 @@ type OrganizationResolver interface { } type QueryResolver interface { Node(ctx context.Context, id gid.GID) (types.Node, error) + Viewer(ctx context.Context) (*types.Viewer, error) } type TaskResolver interface { StateTransisions(ctx context.Context, obj *types.Task, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.TaskStateTransitionConnection, error) Evidences(ctx context.Context, obj *types.Task, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.EvidenceConnection, error) } +type ViewerResolver interface { + Organization(ctx context.Context, obj *types.Viewer) (*types.Organization, error) +} type executableSchema struct { schema *ast.Schema @@ -1040,6 +1051,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.Query.Node(childComplexity, args["id"].(gid.GID)), true + case "Query.viewer": + if e.complexity.Query.Viewer == nil { + break + } + + return e.complexity.Query.Viewer(childComplexity), true + case "Task.createdAt": if e.complexity.Task.CreatedAt == nil { break @@ -1323,6 +1341,20 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.VendorEdge.Node(childComplexity), true + case "Viewer.id": + if e.complexity.Viewer.ID == nil { + break + } + + return e.complexity.Viewer.ID(childComplexity), true + + case "Viewer.organization": + if e.complexity.Viewer.Organization == nil { + break + } + + return e.complexity.Viewer.Organization(childComplexity), true + } return 0, false } @@ -1441,13 +1473,11 @@ var sources = []*ast.Source{ ) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION directive @goModel( - model: String - models: [String!] + model: String + models: [String!] ) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION -directive @goEnum( - value: String -) on ENUM_VALUE +directive @goEnum(value: String) on ENUM_VALUE scalar CursorKey scalar Void @@ -1458,27 +1488,62 @@ interface Node { id: ID! } -enum ControlState @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.ControlState") { - NOT_STARTED @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateNotStarted") - IN_PROGRESS @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateInProgress") - NOT_APPLICABLE @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateNotApplicable") - IMPLEMENTED @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateImplemented") +enum ControlState + @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.ControlState") { + NOT_STARTED + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateNotStarted" + ) + IN_PROGRESS + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateInProgress" + ) + NOT_APPLICABLE + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateNotApplicable" + ) + IMPLEMENTED + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ControlStateImplemented" + ) } -enum TaskState @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.TaskState") { - TODO @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.TaskStateTodo") - DONE @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.TaskStateDone") +enum TaskState + @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.TaskState") { + TODO + @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.TaskStateTodo") + DONE + @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.TaskStateDone") } -enum EvidenceState @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceState") { - VALID @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceStateValid") - INVALID @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceStateInvalid") - EXPIRED @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceStateExpired") +enum EvidenceState + @goModel( + model: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceState" + ) { + VALID + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceStateValid" + ) + INVALID + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceStateInvalid" + ) + EXPIRED + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.EvidenceStateExpired" + ) } -enum PeopleKind @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKind") { - EMPLOYEE @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindEmployee") - CONTRACTOR @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindContractor") +enum PeopleKind + @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKind") { + EMPLOYEE + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindEmployee" + ) + CONTRACTOR + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.PeopleKindContractor" + ) } type PageInfo { @@ -1674,7 +1739,7 @@ type Task implements Node { last: Int before: CursorKey ): EvidenceConnection! @goField(forceResolver: true) - + createdAt: Datetime! updatedAt: Datetime! } @@ -1747,6 +1812,12 @@ type EvidenceStateTransition { type Query { node(id: ID!): Node! + viewer: Viewer! +} + +type Viewer { + id: ID! + organization: Organization! @goField(forceResolver: true) } type Mutation { @@ -1796,16 +1867,38 @@ input UpdatePeopleInput { kind: PeopleKind } -enum ServiceCriticality @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticality") { - LOW @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticalityLow") - MEDIUM @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticalityMedium") - HIGH @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticalityHigh") +enum ServiceCriticality + @goModel( + model: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticality" + ) { + LOW + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticalityLow" + ) + MEDIUM + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticalityMedium" + ) + HIGH + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.ServiceCriticalityHigh" + ) } -enum RiskTier @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.RiskTier") { - CRITICAL @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.RiskTierCritical") - SIGNIFICANT @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.RiskTierSignificant") - GENERAL @goEnum(value: "github.com/getprobo/probo/pkg/probo/coredata.RiskTierGeneral") +enum RiskTier + @goModel(model: "github.com/getprobo/probo/pkg/probo/coredata.RiskTier") { + CRITICAL + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.RiskTierCritical" + ) + SIGNIFICANT + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.RiskTierSignificant" + ) + GENERAL + @goEnum( + value: "github.com/getprobo/probo/pkg/probo/coredata.RiskTierGeneral" + ) } input UpdateVendorInput { @@ -6558,6 +6651,50 @@ func (ec *executionContext) fieldContext_Query_node(ctx context.Context, field g return fc, nil } +func (ec *executionContext) _Query_viewer(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Query_viewer(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 ec.resolvers.Query().Viewer(rctx) + }) + 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.Viewer) + fc.Result = res + return ec.marshalNViewer2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐViewer(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Query_viewer(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Query", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Viewer_id(ctx, field) + case "organization": + return ec.fieldContext_Viewer_organization(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Viewer", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _Query___type(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Query___type(ctx, field) if err != nil { @@ -8263,6 +8400,100 @@ func (ec *executionContext) fieldContext_VendorEdge_node(_ context.Context, fiel return fc, nil } +func (ec *executionContext) _Viewer_id(ctx context.Context, field graphql.CollectedField, obj *types.Viewer) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Viewer_id(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.ID, 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.(gid.GID) + fc.Result = res + return ec.marshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Viewer_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Viewer", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type ID does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Viewer_organization(ctx context.Context, field graphql.CollectedField, obj *types.Viewer) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Viewer_organization(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 ec.resolvers.Viewer().Organization(rctx, obj) + }) + 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.Organization) + fc.Result = res + return ec.marshalNOrganization2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐOrganization(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Viewer_organization(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Viewer", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_Organization_id(ctx, field) + case "name": + return ec.fieldContext_Organization_name(ctx, field) + case "logoUrl": + return ec.fieldContext_Organization_logoUrl(ctx, field) + case "frameworks": + return ec.fieldContext_Organization_frameworks(ctx, field) + case "vendors": + return ec.fieldContext_Organization_vendors(ctx, field) + case "peoples": + return ec.fieldContext_Organization_peoples(ctx, field) + case "createdAt": + return ec.fieldContext_Organization_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Organization_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Organization", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) ___Directive_name(ctx context.Context, field graphql.CollectedField, obj *introspection.Directive) (ret graphql.Marshaler) { fc, err := ec.fieldContext___Directive_name(ctx, field) if err != nil { @@ -11752,6 +11983,23 @@ func (ec *executionContext) _Query(ctx context.Context, sel ast.SelectionSet) gr func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) + case "viewer": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + res = ec._Query_viewer(ctx, field) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + rrm := func(ctx context.Context) graphql.Marshaler { + return ec.OperationContext.RootResolverMiddleware(ctx, + func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return rrm(innerCtx) }) case "__type": out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { @@ -12319,6 +12567,76 @@ func (ec *executionContext) _VendorEdge(ctx context.Context, sel ast.SelectionSe return out } +var viewerImplementors = []string{"Viewer"} + +func (ec *executionContext) _Viewer(ctx context.Context, sel ast.SelectionSet, obj *types.Viewer) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, viewerImplementors) + + 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("Viewer") + case "id": + out.Values[i] = ec._Viewer_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "organization": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + res = ec._Viewer_organization(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + 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 __DirectiveImplementors = []string{"__Directive"} func (ec *executionContext) ___Directive(ctx context.Context, sel ast.SelectionSet, obj *introspection.Directive) graphql.Marshaler { @@ -13226,6 +13544,20 @@ func (ec *executionContext) marshalNNode2githubᚗcomᚋgetproboᚋproboᚋpkg return ec._Node(ctx, sel, v) } +func (ec *executionContext) marshalNOrganization2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐOrganization(ctx context.Context, sel ast.SelectionSet, v types.Organization) graphql.Marshaler { + return ec._Organization(ctx, sel, &v) +} + +func (ec *executionContext) marshalNOrganization2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐOrganization(ctx context.Context, sel ast.SelectionSet, v *types.Organization) 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._Organization(ctx, sel, v) +} + func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐPageInfo(ctx context.Context, sel ast.SelectionSet, v *types.PageInfo) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -13701,6 +14033,20 @@ func (ec *executionContext) marshalNVendorEdge2ᚖgithubᚗcomᚋgetproboᚋprob return ec._VendorEdge(ctx, sel, v) } +func (ec *executionContext) marshalNViewer2githubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐViewer(ctx context.Context, sel ast.SelectionSet, v types.Viewer) graphql.Marshaler { + return ec._Viewer(ctx, sel, &v) +} + +func (ec *executionContext) marshalNViewer2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋapiᚋconsoleᚋv1ᚋtypesᚐViewer(ctx context.Context, sel ast.SelectionSet, v *types.Viewer) 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._Viewer(ctx, sel, v) +} + func (ec *executionContext) marshalN__Directive2githubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚋintrospectionᚐDirective(ctx context.Context, sel ast.SelectionSet, v introspection.Directive) graphql.Marshaler { return ec.___Directive(ctx, sel, &v) } diff --git a/pkg/api/console/v1/types/types.go b/pkg/api/console/v1/types/types.go index 88a70947b..84b27d038 100644 --- a/pkg/api/console/v1/types/types.go +++ b/pkg/api/console/v1/types/types.go @@ -314,3 +314,8 @@ type VendorEdge struct { Cursor page.CursorKey `json:"cursor"` Node *Vendor `json:"node"` } + +type Viewer struct { + ID gid.GID `json:"id"` + Organization *Organization `json:"organization"` +} diff --git a/pkg/api/console/v1/v1_resolver.go b/pkg/api/console/v1/v1_resolver.go index 525f47c2a..32b7bd2ea 100644 --- a/pkg/api/console/v1/v1_resolver.go +++ b/pkg/api/console/v1/v1_resolver.go @@ -263,6 +263,11 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error return nil, gqlerror.Errorf("node %q not found", id) } +// Viewer is the resolver for the viewer field. +func (r *queryResolver) Viewer(ctx context.Context) (*types.Viewer, error) { + return &types.Viewer{}, nil +} + // StateTransisions is the resolver for the stateTransisions field. func (r *taskResolver) StateTransisions(ctx context.Context, obj *types.Task, first *int, after *page.CursorKey, last *int, before *page.CursorKey) (*types.TaskStateTransitionConnection, error) { cursor := types.NewCursor(first, after, last, before) @@ -287,6 +292,17 @@ func (r *taskResolver) Evidences(ctx context.Context, obj *types.Task, first *in return types.NewEvidenceConnection(page), nil } +// Organization is the resolver for the organization field. +func (r *viewerResolver) Organization(ctx context.Context, obj *types.Viewer) (*types.Organization, error) { + organizationID, _ := gid.ParseGID("AZSfP_xAcAC5IAAAAAAltA") // TODO: remove this + organization, err := r.svc.GetOrganization(ctx, organizationID) + if err != nil { + return nil, fmt.Errorf("cannot get organization: %w", err) + } + + return types.NewOrganization(organization), nil +} + // Control returns schema.ControlResolver implementation. func (r *Resolver) Control() schema.ControlResolver { return &controlResolver{r} } @@ -308,6 +324,9 @@ func (r *Resolver) Query() schema.QueryResolver { return &queryResolver{r} } // Task returns schema.TaskResolver implementation. func (r *Resolver) Task() schema.TaskResolver { return &taskResolver{r} } +// Viewer returns schema.ViewerResolver implementation. +func (r *Resolver) Viewer() schema.ViewerResolver { return &viewerResolver{r} } + type controlResolver struct{ *Resolver } type evidenceResolver struct{ *Resolver } type frameworkResolver struct{ *Resolver } @@ -315,3 +334,4 @@ type mutationResolver struct{ *Resolver } type organizationResolver struct{ *Resolver } type queryResolver struct{ *Resolver } type taskResolver struct{ *Resolver } +type viewerResolver struct{ *Resolver }