diff --git a/apps/console/src/components/NavMain.tsx b/apps/console/src/components/NavMain.tsx index 65420343e..e6916c498 100644 --- a/apps/console/src/components/NavMain.tsx +++ b/apps/console/src/components/NavMain.tsx @@ -7,6 +7,12 @@ import { Store, type LucideIcon, Flame, + BookOpen, + FileText, + Settings, + Users, + Box, + Database } from "lucide-react"; import { Link, useLocation, useParams } from "react-router"; @@ -25,7 +31,6 @@ import { SidebarMenuSubButton, SidebarMenuSubItem, } from "@/components/ui/sidebar"; -import { BookOpen, FileText, Settings, Users, Box } from "lucide-react"; interface NavItem { title: string; @@ -187,6 +192,13 @@ function getNavItems(organizationId?: string): NavItem[] { : undefined, icon: Box, }, + { + title: "Data", + url: organizationId + ? `/organizations/${organizationId}/data` + : undefined, + icon: Database, + }, { title: "Settings", url: organizationId diff --git a/apps/console/src/pages/organizations/Routes.tsx b/apps/console/src/pages/organizations/Routes.tsx index 87f388b00..c24975b4e 100644 --- a/apps/console/src/pages/organizations/Routes.tsx +++ b/apps/console/src/pages/organizations/Routes.tsx @@ -31,6 +31,9 @@ import { ListTaskPage } from "./tasks/ListTaskPage"; import { AssetsListPage } from "./assets/AssetsListPage"; import { NewAssetPage } from "./assets/NewAssetPage"; import { AssetPage } from "./assets/AssetPage"; +import { DataListPage } from "./data/DataListPage"; +import { NewDatumPage } from "./data/NewDatumPage"; +import { DatumPage } from "./data/DatumPage"; export function OrganizationsRoutes() { return ( @@ -70,6 +73,9 @@ export function OrganizationsRoutes() { } /> } /> } /> + } /> + } /> + } /> } /> } /> diff --git a/apps/console/src/pages/organizations/data/DataListPage.tsx b/apps/console/src/pages/organizations/data/DataListPage.tsx new file mode 100644 index 000000000..8a994aa4a --- /dev/null +++ b/apps/console/src/pages/organizations/data/DataListPage.tsx @@ -0,0 +1,52 @@ +import { Skeleton } from "@/components/ui/skeleton"; +import { PageTemplate } from "@/components/PageTemplate"; +import { useLocation } from "react-router"; +import { Suspense } from "react"; +import { ErrorBoundaryWithLocation } from "../ErrorBoundary"; +import { lazy } from "@probo/react-lazy"; + +const DataListView = lazy(() => import("./DataListView")); + +export function DataListViewSkeleton() { + return ( + +
+ {Array.from({ length: 5 }).map((_, i) => ( +
+
+ +
+ + +
+
+
+ + + + +
+
+ ))} +
+
+ ); +} + +export function DataListPage() { + const location = useLocation(); + + return ( + }> + + + + + ); +} diff --git a/apps/console/src/pages/organizations/data/DataListView.tsx b/apps/console/src/pages/organizations/data/DataListView.tsx new file mode 100644 index 000000000..c68526d9d --- /dev/null +++ b/apps/console/src/pages/organizations/data/DataListView.tsx @@ -0,0 +1,363 @@ +import { Suspense, useEffect, useTransition, useRef } from "react"; +import { + graphql, + PreloadedQuery, + usePreloadedQuery, + useQueryLoader, + useMutation, + usePaginationFragment, +} from "react-relay"; +import { useSearchParams, useParams } from "react-router"; +import { Avatar, AvatarFallback } from "@/components/ui/avatar"; +import { Badge } from "@/components/ui/badge"; +import { Database, Plus, Trash2, ChevronRight } from "lucide-react"; +import { Button } from "@/components/ui/button"; +import { Link } from "react-router"; +import type { DataListViewQuery as DataListViewQueryType } from "./__generated__/DataListViewQuery.graphql"; +import type { DataListViewDeleteDataMutation } from "./__generated__/DataListViewDeleteDataMutation.graphql"; +import { DataListViewPaginationQuery } from "./__generated__/DataListViewPaginationQuery.graphql"; +import { DataListView_data$key } from "./__generated__/DataListView_data.graphql"; +import { PageTemplate } from "@/components/PageTemplate"; +import { DataListViewSkeleton } from "./DataListPage"; + +const ITEMS_PER_PAGE = 25; + +const dataListViewQuery = graphql` + query DataListViewQuery( + $organizationId: ID! + $first: Int + $after: CursorKey + $last: Int + $before: CursorKey + ) { + organization: node(id: $organizationId) { + ...DataListView_data + @arguments(first: $first, after: $after, last: $last, before: $before) + } + } +`; + +const dataListFragment = graphql` + fragment DataListView_data on Organization + @refetchable(queryName: "DataListViewPaginationQuery") + @argumentDefinitions( + first: { type: "Int" } + after: { type: "CursorKey" } + last: { type: "Int" } + before: { type: "CursorKey" } + ) { + id + data( + first: $first + after: $after + last: $last + before: $before + orderBy: { direction: ASC, field: NAME } + ) @connection(key: "DataListView_data") { + __id + edges { + node { + id + name + dataSensitivity + owner { + id + fullName + } + vendors { + edges { + node { + id + name + } + } + } + createdAt + updatedAt + } + } + pageInfo { + hasNextPage + hasPreviousPage + startCursor + endCursor + } + } + } +`; + +const deleteDataMutation = graphql` + mutation DataListViewDeleteDataMutation( + $input: DeleteDatumInput! + $connections: [ID!]! + ) { + deleteDatum(input: $input) { + deletedDatumId @deleteEdge(connections: $connections) + } + } +`; + +function LoadAboveButton({ + isLoading, + hasMore, + onLoadMore, +}: { + isLoading: boolean; + hasMore: boolean; + onLoadMore: () => void; +}) { + if (!hasMore) { + return null; + } + + return ( +
+ +
+ ); +} + +function LoadBelowButton({ + isLoading, + hasMore, + onLoadMore, +}: { + isLoading: boolean; + hasMore: boolean; + onLoadMore: () => void; +}) { + if (!hasMore) { + return null; + } + + return ( +
+ +
+ ); +} + +function DataListContent({ + queryRef, +}: { + queryRef: PreloadedQuery; +}) { + const data = usePreloadedQuery( + dataListViewQuery, + queryRef, + ); + const [, setSearchParams] = useSearchParams(); + const [, startTransition] = useTransition(); + const [deleteData] = + useMutation(deleteDataMutation); + const { organizationId } = useParams(); + const isPaginationUpdate = useRef(false); + + const { + data: dataConnection, + loadNext, + loadPrevious, + hasNext, + hasPrevious, + isLoadingNext, + isLoadingPrevious, + } = usePaginationFragment< + DataListViewPaginationQuery, + DataListView_data$key + >(dataListFragment, data.organization); + + const dataItems = dataConnection.data.edges.map((edge) => edge.node) ?? []; + const pageInfo = dataConnection.data.pageInfo; + + return ( + <> + + + + Add data + + + } + > +
+
+ {dataItems.map((item) => ( + +
+
+ + + + + +
+
+

{item?.name}

+ {item?.owner?.fullName && ( + <> + • +

+ Owned by {item.owner.fullName} +

+ + )} +
+ {item?.vendors?.edges?.length > 0 && ( +
+ Vendors: {item.vendors.edges.map(edge => edge?.node?.name).join(", ")} +
+ )} +
+
+
+ + {item?.dataSensitivity === "NONE" + ? "No sensitive data" + : item?.dataSensitivity === "LOW" + ? "Public or non-sensitive data" + : item?.dataSensitivity === "MEDIUM" + ? "Internal/restricted data" + : item?.dataSensitivity === "HIGH" + ? "Confidential data" + : item?.dataSensitivity === "CRITICAL" + ? "Regulated/PII/financial data" + : "No sensitive data"} + + + +
+
+ + ))} +
+ + { + startTransition(() => { + isPaginationUpdate.current = true; + setSearchParams((prev) => { + prev.set("before", pageInfo?.startCursor || ""); + prev.delete("after"); + return prev; + }); + loadPrevious(ITEMS_PER_PAGE); + }); + }} + /> + { + startTransition(() => { + isPaginationUpdate.current = true; + setSearchParams((prev) => { + prev.set("after", pageInfo?.endCursor || ""); + prev.delete("before"); + return prev; + }); + loadNext(ITEMS_PER_PAGE); + }); + }} + /> +
+
+ + ); +} + +export default function DataListView() { + const [searchParams] = useSearchParams(); + const [queryRef, loadQuery] = + useQueryLoader(dataListViewQuery); + const { organizationId } = useParams(); + const isPaginationUpdate = useRef(false); + + useEffect(() => { + const after = searchParams.get("after"); + const before = searchParams.get("before"); + + // Skip the query if this was triggered by pagination + if (isPaginationUpdate.current) { + isPaginationUpdate.current = false; + return; + } + + loadQuery({ + organizationId: organizationId!, + first: before ? undefined : ITEMS_PER_PAGE, + after: after || undefined, + last: before ? ITEMS_PER_PAGE : undefined, + before: before || undefined, + }); + }, [loadQuery, organizationId, searchParams]); + + if (!queryRef) { + return ; + } + + return ( + }> + + + ); +} diff --git a/apps/console/src/pages/organizations/data/DatumPage.tsx b/apps/console/src/pages/organizations/data/DatumPage.tsx new file mode 100644 index 000000000..3c8caa4d6 --- /dev/null +++ b/apps/console/src/pages/organizations/data/DatumPage.tsx @@ -0,0 +1,40 @@ +import { PageTemplateSkeleton } from "@/components/PageTemplate"; +import { Suspense } from "react"; +import { lazy } from "@probo/react-lazy"; +import { useLocation } from "react-router"; +import { ErrorBoundaryWithLocation } from "../ErrorBoundary"; + +const DatumView = lazy(() => import("./DatumView")); + +export function DatumViewSkeleton() { + return ( + +
+
+
+
+
+
+ {[1, 2].map((i) => ( +
+ ))} +
+
+ + ); +} + +export function DatumPage() { + const location = useLocation(); + + return ( + }> + + + + + ); +} diff --git a/apps/console/src/pages/organizations/data/DatumView.tsx b/apps/console/src/pages/organizations/data/DatumView.tsx new file mode 100644 index 000000000..c392fa2f1 --- /dev/null +++ b/apps/console/src/pages/organizations/data/DatumView.tsx @@ -0,0 +1,372 @@ +"use client"; + +import { Card } from "@/components/ui/card"; +import { Label } from "@/components/ui/label"; +import { Input } from "@/components/ui/input"; +import { Button } from "@/components/ui/button"; +import { useToast } from "@/hooks/use-toast"; +import { + graphql, + PreloadedQuery, + usePreloadedQuery, + useQueryLoader, + useMutation, +} from "react-relay"; +import { Suspense, useEffect, useState, useCallback } from "react"; +import type { DatumViewQuery as DatumViewQueryType } from "./__generated__/DatumViewQuery.graphql"; +import { useParams } from "react-router"; +import { PageTemplate } from "@/components/PageTemplate"; +import { DatumViewSkeleton } from "./DatumPage"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import PeopleSelector from "@/components/PeopleSelector"; +import { Badge } from "@/components/ui/badge"; +import { X } from "lucide-react"; + +const datumViewQuery = graphql` + query DatumViewQuery($datumId: ID!, $organizationId: ID!) { + node(id: $datumId) { + ... on Datum { + id + name + dataSensitivity + vendors { + edges { + node { + id + name + } + } + } + owner { + id + fullName + } + createdAt + updatedAt + } + } + organization: node(id: $organizationId) { + ... on Organization { + id + ...PeopleSelector_organization + vendors(first: 100, orderBy: { direction: ASC, field: NAME }) @connection(key: "DatumView_vendors") { + edges { + node { + id + name + } + } + } + } + } + } +`; + +const updateDatumMutation = graphql` + mutation DatumViewUpdateDatumMutation($input: UpdateDatumInput!) { + updateDatum(input: $input) { + datum { + id + name + dataSensitivity + vendors { + edges { + node { + id + } + } + } + owner { + id + fullName + } + updatedAt + } + } + } +`; + +type DataSensitivity = "NONE" | "LOW" | "MEDIUM" | "HIGH" | "CRITICAL"; + +interface Datum { + readonly id?: string; + readonly name?: string; + readonly description?: string; + readonly dataSensitivity?: DataSensitivity; + readonly owner?: { + readonly id: string; + readonly fullName: string; + } | null; + readonly createdAt?: string; + readonly updatedAt?: string; + readonly vendors?: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + readonly name: string; + } | null; + } | null> | null; + } | null; +} + +interface Vendor { + readonly id: string; + readonly name: string; +} + +interface Organization { + readonly id?: string; + readonly vendors?: { + readonly edges: ReadonlyArray<{ + readonly node: Vendor; + } | null> | null; + } | null; +} + +function EditableField({ + label, + value, + onChange, + type = "text", + helpText, +}: { + label: string; + value: string; + onChange: (value: string) => void; + type?: string; + helpText?: string; +}) { + return ( +
+
+ +
+
+ onChange(e.target.value)} + /> + {helpText &&

{helpText}

} +
+
+ ); +} + +function DatumViewContent({ + queryRef, +}: { + queryRef: PreloadedQuery; +}) { + const data = usePreloadedQuery(datumViewQuery, queryRef); + const [editedFields, setEditedFields] = useState>(new Set()); + const datum = data.node as Datum | null; + const organization = data.organization as Organization; + const [formData, setFormData] = useState({ + name: datum?.name || "", + dataSensitivity: datum?.dataSensitivity || "NONE", + ownerId: datum?.owner?.id || "", + selectedVendorIds: datum?.vendors?.edges?.map(edge => edge?.node?.id).filter((id): id is string => id != null) || [], + }); + const [commit] = useMutation(updateDatumMutation); + const { toast } = useToast(); + const hasChanges = editedFields.size > 0; + + const handleSave = useCallback(() => { + const nodeId = data.node?.id; + if (!nodeId) return; + + commit({ + variables: { + input: { + id: nodeId, + name: formData.name, + dataSensitivity: formData.dataSensitivity, + ownerId: formData.ownerId, + vendorIds: formData.selectedVendorIds.length > 0 ? formData.selectedVendorIds : undefined, + }, + }, + onCompleted: () => { + toast({ + title: "Success", + description: "Changes saved successfully", + variant: "default", + }); + setEditedFields(new Set()); + }, + onError: (error) => { + toast({ + title: "Error", + description: error.message || "Failed to save changes", + variant: "destructive", + }); + }, + }); + }, [commit, data.node?.id, formData, toast]); + + const handleFieldChange = (field: keyof typeof formData, value: unknown) => { + setFormData((prev) => ({ + ...prev, + [field]: value, + })); + setEditedFields((prev) => new Set(prev).add(field)); + }; + + const handleVendorSelect = (vendorId: string) => { + setFormData((prev) => ({ + ...prev, + selectedVendorIds: prev.selectedVendorIds.includes(vendorId) + ? prev.selectedVendorIds.filter((id) => id !== vendorId) + : [...prev.selectedVendorIds, vendorId], + })); + setEditedFields((prev) => new Set(prev).add("selectedVendorIds")); + }; + + const handleCancel = () => { + const datum = data.node as Datum | null; + setFormData({ + name: datum?.name || "", + dataSensitivity: datum?.dataSensitivity || "NONE", + ownerId: datum?.owner?.id || "", + selectedVendorIds: datum?.vendors?.edges?.map(edge => edge?.node?.id).filter((id): id is string => id != null) || [], + }); + setEditedFields(new Set()); + }; + + const vendors = (organization.vendors?.edges || []) + .map((edge) => edge?.node) + .filter((node): node is Vendor => node != null); + + return ( + +
+
+ handleFieldChange("name", value)} + /> + + +
+
+

Data Details

+
+ +
+
+
+ +
+ handleFieldChange("ownerId", value)} + placeholder="Select data owner" + /> +
+ +
+ + +
+ {formData.selectedVendorIds.map((vendorId) => { + const vendor = vendors.find((v) => v.id === vendorId); + if (!vendor) return null; + return ( + + {vendor.name} + + + ); + })} +
+
+ +
+
+ +
+ +
+
+
+
+ +
+ + +
+
+
+
+ ); +} + +export default function DatumView() { + const { datumId, organizationId } = useParams(); + const [queryRef, loadQuery] = + useQueryLoader(datumViewQuery); + + useEffect(() => { + loadQuery({ datumId: datumId!, organizationId: organizationId! }); + }, [loadQuery, datumId, organizationId]); + + if (!queryRef || !datumId || !organizationId) { + return ; + } + + return ( + }> + + + ); +} diff --git a/apps/console/src/pages/organizations/data/NewDatumPage.tsx b/apps/console/src/pages/organizations/data/NewDatumPage.tsx new file mode 100644 index 000000000..a4f96d818 --- /dev/null +++ b/apps/console/src/pages/organizations/data/NewDatumPage.tsx @@ -0,0 +1,41 @@ +import { Suspense } from "react"; +import { ErrorBoundaryWithLocation } from "../ErrorBoundary"; +import { lazy } from "@probo/react-lazy"; +import { PageTemplate } from "@/components/PageTemplate"; +import { Skeleton } from "@/components/ui/skeleton"; + +const NewDatumView = lazy(() => import("./NewDatumView")); + +export function NewDatumViewSkeleton() { + return ( + +
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ ); +} +export function NewDatumPage() { + return ( + }> + + + + + ); +} diff --git a/apps/console/src/pages/organizations/data/NewDatumView.tsx b/apps/console/src/pages/organizations/data/NewDatumView.tsx new file mode 100644 index 000000000..7eba8a3b3 --- /dev/null +++ b/apps/console/src/pages/organizations/data/NewDatumView.tsx @@ -0,0 +1,319 @@ +import { useState, Suspense, useEffect } from "react"; +import { useNavigate, useParams } from "react-router"; +import { graphql, useMutation, ConnectionHandler, useQueryLoader, PreloadedQuery, usePreloadedQuery } from "react-relay"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { useToast } from "@/hooks/use-toast"; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; +import { PageTemplate } from "@/components/PageTemplate"; +import { NewDatumViewCreateDatumMutation, CreateDatumInput } from "./__generated__/NewDatumViewCreateDatumMutation.graphql"; +import { NewDatumViewQuery } from "./__generated__/NewDatumViewQuery.graphql"; +import PeopleSelector from "@/components/PeopleSelector"; +import { NewDatumViewSkeleton } from "./NewDatumPage"; +import { Badge } from "@/components/ui/badge"; +import { X } from "lucide-react"; + +const newDatumViewQuery = graphql` + query NewDatumViewQuery($organizationId: ID!) { + organization: node(id: $organizationId) { + ... on Organization { + id + ...PeopleSelector_organization + vendors(first: 100, orderBy: { direction: ASC, field: NAME }) @connection(key: "NewDatumView_vendors") { + edges { + node { + id + name + } + } + } + } + } + } +`; + +const createDatumMutation = graphql` + mutation NewDatumViewCreateDatumMutation( + $input: CreateDatumInput! + $connections: [ID!]! + ) { + createDatum(input: $input) { + datumEdge @prependEdge(connections: $connections) { + node { + id + name + dataSensitivity + owner { + id + fullName + } + vendors { + edges { + node { + id + name + } + } + } + } + } + } + } +`; + +interface Vendor { + readonly id: string; + readonly name: string; +} + +interface Organization { + readonly id?: string; + readonly vendors?: { + readonly edges: ReadonlyArray<{ + readonly node: Vendor; + } | null> | null; + } | null; +} + +function EditableField({ + label, + value, + onChange, + type = "text", + helpText, + required, +}: { + label: string; + value: string; + onChange: (value: string) => void; + type?: string; + helpText?: string; + required?: boolean; +}) { + return ( +
+
+ +
+
+ onChange(e.target.value)} + required={required} + /> + {helpText &&

{helpText}

} +
+
+ ); +} + +function NewDataViewContent({ + queryRef, +}: { + queryRef: PreloadedQuery; +}) { + const navigate = useNavigate(); + const { organizationId } = useParams(); + const [createData] = useMutation(createDatumMutation); + const { toast } = useToast(); + const data = usePreloadedQuery(newDatumViewQuery, queryRef); + + if (!data.organization) { + return
Organization not found
; + } + + const organization = data.organization as Organization; + + const [formData, setFormData] = useState({ + name: "", + dataSensitivity: "NONE" as "NONE" | "LOW" | "MEDIUM" | "HIGH" | "CRITICAL", + ownerId: "", + selectedVendorIds: [] as string[], + }); + + type FormData = typeof formData; + + const handleFieldChange = ( + field: K, + value: FormData[K] + ) => { + setFormData((prev) => ({ + ...prev, + [field]: value, + })); + }; + + const handleVendorSelect = (vendorId: string) => { + setFormData((prev) => ({ + ...prev, + selectedVendorIds: prev.selectedVendorIds.includes(vendorId) + ? prev.selectedVendorIds.filter((id) => id !== vendorId) + : [...prev.selectedVendorIds, vendorId], + })); + }; + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + + if (!formData.ownerId) { + toast({ + title: "Error", + description: "Please select an owner", + variant: "destructive", + }); + return; + } + + createData({ + variables: { + connections: [ + ConnectionHandler.getConnectionID( + organizationId!, + "DataListView_data", + { + orderBy: { + direction: "ASC", + field: "NAME", + }, + }, + ), + ], + input: { + organizationId: organizationId!, + name: formData.name, + dataSensitivity: formData.dataSensitivity, + ownerId: formData.ownerId, + vendorIds: formData.selectedVendorIds.length > 0 ? formData.selectedVendorIds : undefined, + } satisfies CreateDatumInput, + }, + onCompleted: () => { + toast({ + title: "Success", + description: "Data created successfully", + variant: "default", + }); + navigate(`/organizations/${organizationId}/data`); + }, + onError: (error) => { + toast({ + title: "Error", + description: error.message || "Failed to create data", + variant: "destructive", + }); + }, + }); + }; + + const vendors = (organization.vendors?.edges || []) + .map((edge) => edge?.node) + .filter((node): node is Vendor => node != null); + + return ( + +
+
+ handleFieldChange("name", value)} + required + /> + +
+ + handleFieldChange("ownerId", value)} + placeholder="Select data owner" + required + /> +
+ +
+ + +
+ {formData.selectedVendorIds.map((vendorId) => { + const vendor = vendors.find((v) => v.id === vendorId); + if (!vendor) return null; + return ( + + {vendor.name} + + + ); + })} +
+
+ +
+ + +
+ + +
+
+
+ ); +} + +export default function NewDatumView() { + const { organizationId } = useParams(); + const [queryRef, loadQuery] = useQueryLoader(newDatumViewQuery); + + useEffect(() => { + loadQuery({ organizationId: organizationId! }); + }, [loadQuery, organizationId]); + + if (!queryRef) { + return ; + } + + return ( + }> + + + ); +} diff --git a/apps/console/src/pages/organizations/data/__generated__/DataListViewDeleteDataMutation.graphql.ts b/apps/console/src/pages/organizations/data/__generated__/DataListViewDeleteDataMutation.graphql.ts new file mode 100644 index 000000000..b618f558a --- /dev/null +++ b/apps/console/src/pages/organizations/data/__generated__/DataListViewDeleteDataMutation.graphql.ts @@ -0,0 +1,132 @@ +/** + * @generated SignedSource<<0957856377454a1d927ba7bcf1d84cac>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +export type DeleteDatumInput = { + datumId: string; +}; +export type DataListViewDeleteDataMutation$variables = { + connections: ReadonlyArray; + input: DeleteDatumInput; +}; +export type DataListViewDeleteDataMutation$data = { + readonly deleteDatum: { + readonly deletedDatumId: string; + }; +}; +export type DataListViewDeleteDataMutation = { + response: DataListViewDeleteDataMutation$data; + variables: DataListViewDeleteDataMutation$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "connections" +}, +v1 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "input" +}, +v2 = [ + { + "kind": "Variable", + "name": "input", + "variableName": "input" + } +], +v3 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "deletedDatumId", + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": [ + (v0/*: any*/), + (v1/*: any*/) + ], + "kind": "Fragment", + "metadata": null, + "name": "DataListViewDeleteDataMutation", + "selections": [ + { + "alias": null, + "args": (v2/*: any*/), + "concreteType": "DeleteDatumPayload", + "kind": "LinkedField", + "name": "deleteDatum", + "plural": false, + "selections": [ + (v3/*: any*/) + ], + "storageKey": null + } + ], + "type": "Mutation", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [ + (v1/*: any*/), + (v0/*: any*/) + ], + "kind": "Operation", + "name": "DataListViewDeleteDataMutation", + "selections": [ + { + "alias": null, + "args": (v2/*: any*/), + "concreteType": "DeleteDatumPayload", + "kind": "LinkedField", + "name": "deleteDatum", + "plural": false, + "selections": [ + (v3/*: any*/), + { + "alias": null, + "args": null, + "filters": null, + "handle": "deleteEdge", + "key": "", + "kind": "ScalarHandle", + "name": "deletedDatumId", + "handleArgs": [ + { + "kind": "Variable", + "name": "connections", + "variableName": "connections" + } + ] + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "27043dcacab7e2b4be1fb792f26dafff", + "id": null, + "metadata": {}, + "name": "DataListViewDeleteDataMutation", + "operationKind": "mutation", + "text": "mutation DataListViewDeleteDataMutation(\n $input: DeleteDatumInput!\n) {\n deleteDatum(input: $input) {\n deletedDatumId\n }\n}\n" + } +}; +})(); + +(node as any).hash = "05293e1e936af583e13073c8c06d14dd"; + +export default node; diff --git a/apps/console/src/pages/organizations/data/__generated__/DataListViewPaginationQuery.graphql.ts b/apps/console/src/pages/organizations/data/__generated__/DataListViewPaginationQuery.graphql.ts new file mode 100644 index 000000000..12b1f236f --- /dev/null +++ b/apps/console/src/pages/organizations/data/__generated__/DataListViewPaginationQuery.graphql.ts @@ -0,0 +1,383 @@ +/** + * @generated SignedSource<<9fb6bfbd0ba80aa33ef3d8edfdb53a19>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type DataListViewPaginationQuery$variables = { + after?: string | null | undefined; + before?: string | null | undefined; + first?: number | null | undefined; + id: string; + last?: number | null | undefined; +}; +export type DataListViewPaginationQuery$data = { + readonly node: { + readonly " $fragmentSpreads": FragmentRefs<"DataListView_data">; + }; +}; +export type DataListViewPaginationQuery = { + response: DataListViewPaginationQuery$data; + variables: DataListViewPaginationQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "after" +}, +v1 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "before" +}, +v2 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "first" +}, +v3 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "id" +}, +v4 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "last" +}, +v5 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "id" + } +], +v6 = { + "kind": "Variable", + "name": "after", + "variableName": "after" +}, +v7 = { + "kind": "Variable", + "name": "before", + "variableName": "before" +}, +v8 = { + "kind": "Variable", + "name": "first", + "variableName": "first" +}, +v9 = { + "kind": "Variable", + "name": "last", + "variableName": "last" +}, +v10 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null +}, +v11 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v12 = [ + (v6/*: any*/), + (v7/*: any*/), + (v8/*: any*/), + (v9/*: any*/), + { + "kind": "Literal", + "name": "orderBy", + "value": { + "direction": "ASC", + "field": "NAME" + } + } +], +v13 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": [ + (v0/*: any*/), + (v1/*: any*/), + (v2/*: any*/), + (v3/*: any*/), + (v4/*: any*/) + ], + "kind": "Fragment", + "metadata": null, + "name": "DataListViewPaginationQuery", + "selections": [ + { + "alias": null, + "args": (v5/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "args": [ + (v6/*: any*/), + (v7/*: any*/), + (v8/*: any*/), + (v9/*: any*/) + ], + "kind": "FragmentSpread", + "name": "DataListView_data" + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [ + (v0/*: any*/), + (v1/*: any*/), + (v2/*: any*/), + (v4/*: any*/), + (v3/*: any*/) + ], + "kind": "Operation", + "name": "DataListViewPaginationQuery", + "selections": [ + { + "alias": null, + "args": (v5/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v10/*: any*/), + (v11/*: any*/), + { + "kind": "InlineFragment", + "selections": [ + { + "alias": null, + "args": (v12/*: any*/), + "concreteType": "DatumConnection", + "kind": "LinkedField", + "name": "data", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "DatumEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Datum", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v11/*: any*/), + (v13/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "dataSensitivity", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "People", + "kind": "LinkedField", + "name": "owner", + "plural": false, + "selections": [ + (v11/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + } + ], + "storageKey": null + }, + { + "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": [ + (v11/*: any*/), + (v13/*: any*/) + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "updatedAt", + "storageKey": null + }, + (v10/*: any*/) + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "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 + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } + ], + "storageKey": null + }, + { + "alias": null, + "args": (v12/*: any*/), + "filters": [ + "orderBy" + ], + "handle": "connection", + "key": "DataListView_data", + "kind": "LinkedHandle", + "name": "data" + } + ], + "type": "Organization", + "abstractKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "1a9be11b8d32e569f75ae591226e7b8b", + "id": null, + "metadata": {}, + "name": "DataListViewPaginationQuery", + "operationKind": "query", + "text": "query DataListViewPaginationQuery(\n $after: CursorKey\n $before: CursorKey\n $first: Int\n $last: Int\n $id: ID!\n) {\n node(id: $id) {\n __typename\n ...DataListView_data_pbnwq\n id\n }\n}\n\nfragment DataListView_data_pbnwq on Organization {\n id\n data(first: $first, after: $after, last: $last, before: $before, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n dataSensitivity\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\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 = "d1b1652f1f59c091709bce823b6a0eaa"; + +export default node; diff --git a/apps/console/src/pages/organizations/data/__generated__/DataListViewQuery.graphql.ts b/apps/console/src/pages/organizations/data/__generated__/DataListViewQuery.graphql.ts new file mode 100644 index 000000000..cdd783ec5 --- /dev/null +++ b/apps/console/src/pages/organizations/data/__generated__/DataListViewQuery.graphql.ts @@ -0,0 +1,383 @@ +/** + * @generated SignedSource<<905fb20472d2c30aabb9a9afc41acf41>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type DataListViewQuery$variables = { + after?: string | null | undefined; + before?: string | null | undefined; + first?: number | null | undefined; + last?: number | null | undefined; + organizationId: string; +}; +export type DataListViewQuery$data = { + readonly organization: { + readonly " $fragmentSpreads": FragmentRefs<"DataListView_data">; + }; +}; +export type DataListViewQuery = { + response: DataListViewQuery$data; + variables: DataListViewQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "after" +}, +v1 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "before" +}, +v2 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "first" +}, +v3 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "last" +}, +v4 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "organizationId" +}, +v5 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "organizationId" + } +], +v6 = { + "kind": "Variable", + "name": "after", + "variableName": "after" +}, +v7 = { + "kind": "Variable", + "name": "before", + "variableName": "before" +}, +v8 = { + "kind": "Variable", + "name": "first", + "variableName": "first" +}, +v9 = { + "kind": "Variable", + "name": "last", + "variableName": "last" +}, +v10 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null +}, +v11 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v12 = [ + (v6/*: any*/), + (v7/*: any*/), + (v8/*: any*/), + (v9/*: any*/), + { + "kind": "Literal", + "name": "orderBy", + "value": { + "direction": "ASC", + "field": "NAME" + } + } +], +v13 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": [ + (v0/*: any*/), + (v1/*: any*/), + (v2/*: any*/), + (v3/*: any*/), + (v4/*: any*/) + ], + "kind": "Fragment", + "metadata": null, + "name": "DataListViewQuery", + "selections": [ + { + "alias": "organization", + "args": (v5/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "args": [ + (v6/*: any*/), + (v7/*: any*/), + (v8/*: any*/), + (v9/*: any*/) + ], + "kind": "FragmentSpread", + "name": "DataListView_data" + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [ + (v4/*: any*/), + (v2/*: any*/), + (v0/*: any*/), + (v3/*: any*/), + (v1/*: any*/) + ], + "kind": "Operation", + "name": "DataListViewQuery", + "selections": [ + { + "alias": "organization", + "args": (v5/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v10/*: any*/), + (v11/*: any*/), + { + "kind": "InlineFragment", + "selections": [ + { + "alias": null, + "args": (v12/*: any*/), + "concreteType": "DatumConnection", + "kind": "LinkedField", + "name": "data", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "DatumEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Datum", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v11/*: any*/), + (v13/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "dataSensitivity", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "People", + "kind": "LinkedField", + "name": "owner", + "plural": false, + "selections": [ + (v11/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + } + ], + "storageKey": null + }, + { + "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": [ + (v11/*: any*/), + (v13/*: any*/) + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "updatedAt", + "storageKey": null + }, + (v10/*: any*/) + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "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 + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } + ], + "storageKey": null + }, + { + "alias": null, + "args": (v12/*: any*/), + "filters": [ + "orderBy" + ], + "handle": "connection", + "key": "DataListView_data", + "kind": "LinkedHandle", + "name": "data" + } + ], + "type": "Organization", + "abstractKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "0c5725c38efb32dc65674c4bbd8dd154", + "id": null, + "metadata": {}, + "name": "DataListViewQuery", + "operationKind": "query", + "text": "query DataListViewQuery(\n $organizationId: ID!\n $first: Int\n $after: CursorKey\n $last: Int\n $before: CursorKey\n) {\n organization: node(id: $organizationId) {\n __typename\n ...DataListView_data_pbnwq\n id\n }\n}\n\nfragment DataListView_data_pbnwq on Organization {\n id\n data(first: $first, after: $after, last: $last, before: $before, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n dataSensitivity\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\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 = "f472d43cfa04b97978c717e54c21ce31"; + +export default node; diff --git a/apps/console/src/pages/organizations/data/__generated__/DataListView_data.graphql.ts b/apps/console/src/pages/organizations/data/__generated__/DataListView_data.graphql.ts new file mode 100644 index 000000000..46e335871 --- /dev/null +++ b/apps/console/src/pages/organizations/data/__generated__/DataListView_data.graphql.ts @@ -0,0 +1,321 @@ +/** + * @generated SignedSource<<25f5cfd4e1e5f0724a1082db9d9b10d6>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ReaderFragment } from 'relay-runtime'; +export type DataSensitivity = "CRITICAL" | "HIGH" | "LOW" | "MEDIUM" | "NONE"; +import { FragmentRefs } from "relay-runtime"; +export type DataListView_data$data = { + readonly data: { + readonly __id: string; + readonly edges: ReadonlyArray<{ + readonly node: { + readonly createdAt: string; + readonly dataSensitivity: DataSensitivity; + readonly id: string; + readonly name: string; + readonly owner: { + readonly fullName: string; + readonly id: string; + }; + readonly updatedAt: string; + readonly vendors: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + readonly name: string; + }; + }>; + }; + }; + }>; + readonly pageInfo: { + readonly endCursor: string | null | undefined; + readonly hasNextPage: boolean; + readonly hasPreviousPage: boolean; + readonly startCursor: string | null | undefined; + }; + }; + readonly id: string; + readonly " $fragmentType": "DataListView_data"; +}; +export type DataListView_data$key = { + readonly " $data"?: DataListView_data$data; + readonly " $fragmentSpreads": FragmentRefs<"DataListView_data">; +}; + +const node: ReaderFragment = (function(){ +var v0 = [ + "data" +], +v1 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v2 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null +}; +return { + "argumentDefinitions": [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "after" + }, + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "before" + }, + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "first" + }, + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "last" + } + ], + "kind": "Fragment", + "metadata": { + "connection": [ + { + "count": null, + "cursor": null, + "direction": "bidirectional", + "path": (v0/*: any*/) + } + ], + "refetch": { + "connection": { + "forward": { + "count": "first", + "cursor": "after" + }, + "backward": { + "count": "last", + "cursor": "before" + }, + "path": (v0/*: any*/) + }, + "fragmentPathInResult": [ + "node" + ], + "operation": require('./DataListViewPaginationQuery.graphql'), + "identifierInfo": { + "identifierField": "id", + "identifierQueryVariableName": "id" + } + } + }, + "name": "DataListView_data", + "selections": [ + (v1/*: any*/), + { + "alias": "data", + "args": [ + { + "kind": "Literal", + "name": "orderBy", + "value": { + "direction": "ASC", + "field": "NAME" + } + } + ], + "concreteType": "DatumConnection", + "kind": "LinkedField", + "name": "__DataListView_data_connection", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "DatumEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Datum", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v1/*: any*/), + (v2/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "dataSensitivity", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "People", + "kind": "LinkedField", + "name": "owner", + "plural": false, + "selections": [ + (v1/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + } + ], + "storageKey": null + }, + { + "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": [ + (v1/*: any*/), + (v2/*: any*/) + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "updatedAt", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null + } + ], + "storageKey": null + }, + { + "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 + } + ], + "storageKey": null + }, + { + "kind": "ClientExtension", + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__id", + "storageKey": null + } + ] + } + ], + "storageKey": "__DataListView_data_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"NAME\"})" + } + ], + "type": "Organization", + "abstractKey": null +}; +})(); + +(node as any).hash = "d1b1652f1f59c091709bce823b6a0eaa"; + +export default node; diff --git a/apps/console/src/pages/organizations/data/__generated__/DatumViewQuery.graphql.ts b/apps/console/src/pages/organizations/data/__generated__/DatumViewQuery.graphql.ts new file mode 100644 index 000000000..575dac7c8 --- /dev/null +++ b/apps/console/src/pages/organizations/data/__generated__/DatumViewQuery.graphql.ts @@ -0,0 +1,496 @@ +/** + * @generated SignedSource<<272734160b60bf94a6f031e685751b64>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type DataSensitivity = "CRITICAL" | "HIGH" | "LOW" | "MEDIUM" | "NONE"; +export type DatumViewQuery$variables = { + datumId: string; + organizationId: string; +}; +export type DatumViewQuery$data = { + readonly node: { + readonly createdAt?: string; + readonly dataSensitivity?: DataSensitivity; + readonly id?: string; + readonly name?: string; + readonly owner?: { + readonly fullName: string; + readonly id: string; + }; + readonly updatedAt?: string; + readonly vendors?: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + readonly name: string; + }; + }>; + }; + }; + readonly organization: { + readonly id?: string; + readonly vendors?: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + readonly name: string; + }; + }>; + }; + readonly " $fragmentSpreads": FragmentRefs<"PeopleSelector_organization">; + }; +}; +export type DatumViewQuery = { + response: DatumViewQuery$data; + variables: DatumViewQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "datumId" + }, + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "organizationId" + } +], +v1 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "datumId" + } +], +v2 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v3 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null +}, +v4 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "dataSensitivity", + "storageKey": null +}, +v5 = { + "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": [ + (v2/*: any*/), + (v3/*: any*/) + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null +}, +v6 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null +}, +v7 = { + "alias": null, + "args": null, + "concreteType": "People", + "kind": "LinkedField", + "name": "owner", + "plural": false, + "selections": [ + (v2/*: any*/), + (v6/*: any*/) + ], + "storageKey": null +}, +v8 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "createdAt", + "storageKey": null +}, +v9 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "updatedAt", + "storageKey": null +}, +v10 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "organizationId" + } +], +v11 = { + "kind": "Literal", + "name": "orderBy", + "value": { + "direction": "ASC", + "field": "NAME" + } +}, +v12 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null +}, +v13 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null +}, +v14 = { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + } + ], + "storageKey": null +}, +v15 = [ + { + "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": [ + (v2/*: any*/), + (v3/*: any*/), + (v12/*: any*/) + ], + "storageKey": null + }, + (v13/*: any*/) + ], + "storageKey": null + }, + (v14/*: any*/) +], +v16 = { + "kind": "Literal", + "name": "first", + "value": 100 +}, +v17 = [ + (v16/*: any*/), + { + "kind": "Literal", + "name": "orderBy", + "value": { + "direction": "ASC", + "field": "FULL_NAME" + } + } +], +v18 = [ + "orderBy" +], +v19 = [ + (v16/*: any*/), + (v11/*: any*/) +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "DatumViewQuery", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "kind": "InlineFragment", + "selections": [ + (v2/*: any*/), + (v3/*: any*/), + (v4/*: any*/), + (v5/*: any*/), + (v7/*: any*/), + (v8/*: any*/), + (v9/*: any*/) + ], + "type": "Datum", + "abstractKey": null + } + ], + "storageKey": null + }, + { + "alias": "organization", + "args": (v10/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "kind": "InlineFragment", + "selections": [ + (v2/*: any*/), + { + "args": null, + "kind": "FragmentSpread", + "name": "PeopleSelector_organization" + }, + { + "alias": "vendors", + "args": [ + (v11/*: any*/) + ], + "concreteType": "VendorConnection", + "kind": "LinkedField", + "name": "__DatumView_vendors_connection", + "plural": false, + "selections": (v15/*: any*/), + "storageKey": "__DatumView_vendors_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"NAME\"})" + } + ], + "type": "Organization", + "abstractKey": null + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "DatumViewQuery", + "selections": [ + { + "alias": null, + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v12/*: any*/), + (v2/*: any*/), + { + "kind": "InlineFragment", + "selections": [ + (v3/*: any*/), + (v4/*: any*/), + (v5/*: any*/), + (v7/*: any*/), + (v8/*: any*/), + (v9/*: any*/) + ], + "type": "Datum", + "abstractKey": null + } + ], + "storageKey": null + }, + { + "alias": "organization", + "args": (v10/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v12/*: any*/), + (v2/*: any*/), + { + "kind": "InlineFragment", + "selections": [ + { + "alias": null, + "args": (v17/*: any*/), + "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": [ + (v2/*: any*/), + (v6/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "primaryEmailAddress", + "storageKey": null + }, + (v12/*: any*/) + ], + "storageKey": null + }, + (v13/*: any*/) + ], + "storageKey": null + }, + (v14/*: any*/) + ], + "storageKey": "peoples(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"FULL_NAME\"})" + }, + { + "alias": null, + "args": (v17/*: any*/), + "filters": (v18/*: any*/), + "handle": "connection", + "key": "PeopleSelector_organization_peoples", + "kind": "LinkedHandle", + "name": "peoples" + }, + { + "alias": null, + "args": (v19/*: any*/), + "concreteType": "VendorConnection", + "kind": "LinkedField", + "name": "vendors", + "plural": false, + "selections": (v15/*: any*/), + "storageKey": "vendors(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"NAME\"})" + }, + { + "alias": null, + "args": (v19/*: any*/), + "filters": (v18/*: any*/), + "handle": "connection", + "key": "DatumView_vendors", + "kind": "LinkedHandle", + "name": "vendors" + } + ], + "type": "Organization", + "abstractKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "c3fd8609637a69d90a532344150b4d6a", + "id": null, + "metadata": { + "connection": [ + { + "count": null, + "cursor": null, + "direction": "forward", + "path": [ + "organization", + "vendors" + ] + } + ] + }, + "name": "DatumViewQuery", + "operationKind": "query", + "text": "query DatumViewQuery(\n $datumId: ID!\n $organizationId: ID!\n) {\n node(id: $datumId) {\n __typename\n ... on Datum {\n id\n name\n dataSensitivity\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n owner {\n id\n fullName\n }\n createdAt\n updatedAt\n }\n id\n }\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n ...PeopleSelector_organization\n vendors(first: 100, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n" + } +}; +})(); + +(node as any).hash = "2f759d45493db37e45b3a7166dd36c2e"; + +export default node; diff --git a/apps/console/src/pages/organizations/data/__generated__/DatumViewUpdateDatumMutation.graphql.ts b/apps/console/src/pages/organizations/data/__generated__/DatumViewUpdateDatumMutation.graphql.ts new file mode 100644 index 000000000..ee67d7b47 --- /dev/null +++ b/apps/console/src/pages/organizations/data/__generated__/DatumViewUpdateDatumMutation.graphql.ts @@ -0,0 +1,199 @@ +/** + * @generated SignedSource<<4aa66259b93ace779a3e38430cf8c1ee>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +export type DataSensitivity = "CRITICAL" | "HIGH" | "LOW" | "MEDIUM" | "NONE"; +export type UpdateDatumInput = { + dataSensitivity?: DataSensitivity | null | undefined; + id: string; + name?: string | null | undefined; + ownerId?: string | null | undefined; + vendorIds?: ReadonlyArray | null | undefined; +}; +export type DatumViewUpdateDatumMutation$variables = { + input: UpdateDatumInput; +}; +export type DatumViewUpdateDatumMutation$data = { + readonly updateDatum: { + readonly datum: { + readonly dataSensitivity: DataSensitivity; + readonly id: string; + readonly name: string; + readonly owner: { + readonly fullName: string; + readonly id: string; + }; + readonly updatedAt: string; + readonly vendors: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + }; + }>; + }; + }; + }; +}; +export type DatumViewUpdateDatumMutation = { + response: DatumViewUpdateDatumMutation$data; + variables: DatumViewUpdateDatumMutation$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "input" + } +], +v1 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v2 = [ + { + "alias": null, + "args": [ + { + "kind": "Variable", + "name": "input", + "variableName": "input" + } + ], + "concreteType": "UpdateDatumPayload", + "kind": "LinkedField", + "name": "updateDatum", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Datum", + "kind": "LinkedField", + "name": "datum", + "plural": false, + "selections": [ + (v1/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "dataSensitivity", + "storageKey": null + }, + { + "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": [ + (v1/*: any*/) + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "People", + "kind": "LinkedField", + "name": "owner", + "plural": false, + "selections": [ + (v1/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "updatedAt", + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + } +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "DatumViewUpdateDatumMutation", + "selections": (v2/*: any*/), + "type": "Mutation", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "DatumViewUpdateDatumMutation", + "selections": (v2/*: any*/) + }, + "params": { + "cacheID": "1e5b2489558fef74becf57d2457a4891", + "id": null, + "metadata": {}, + "name": "DatumViewUpdateDatumMutation", + "operationKind": "mutation", + "text": "mutation DatumViewUpdateDatumMutation(\n $input: UpdateDatumInput!\n) {\n updateDatum(input: $input) {\n datum {\n id\n name\n dataSensitivity\n vendors {\n edges {\n node {\n id\n }\n }\n }\n owner {\n id\n fullName\n }\n updatedAt\n }\n }\n}\n" + } +}; +})(); + +(node as any).hash = "ac445fa9f2ccebef8203e0138c794ea8"; + +export default node; diff --git a/apps/console/src/pages/organizations/data/__generated__/NewDataViewQuery.graphql.ts b/apps/console/src/pages/organizations/data/__generated__/NewDataViewQuery.graphql.ts new file mode 100644 index 000000000..04292b68e --- /dev/null +++ b/apps/console/src/pages/organizations/data/__generated__/NewDataViewQuery.graphql.ts @@ -0,0 +1,341 @@ +/** + * @generated SignedSource<<6b0dd599f3eabc5b13ff1cfd8d0c0a7d>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type NewDataViewQuery$variables = { + organizationId: string; +}; +export type NewDataViewQuery$data = { + readonly organization: { + readonly id?: string; + readonly vendors?: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + readonly name: string; + }; + }>; + }; + readonly " $fragmentSpreads": FragmentRefs<"PeopleSelector_organization">; + }; +}; +export type NewDataViewQuery = { + response: NewDataViewQuery$data; + variables: NewDataViewQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "organizationId" + } +], +v1 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "organizationId" + } +], +v2 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v3 = { + "kind": "Literal", + "name": "orderBy", + "value": { + "direction": "ASC", + "field": "NAME" + } +}, +v4 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null +}, +v5 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null +}, +v6 = { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + } + ], + "storageKey": null +}, +v7 = [ + { + "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": [ + (v2/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + (v4/*: any*/) + ], + "storageKey": null + }, + (v5/*: any*/) + ], + "storageKey": null + }, + (v6/*: any*/) +], +v8 = { + "kind": "Literal", + "name": "first", + "value": 100 +}, +v9 = [ + (v8/*: any*/), + { + "kind": "Literal", + "name": "orderBy", + "value": { + "direction": "ASC", + "field": "FULL_NAME" + } + } +], +v10 = [ + "orderBy" +], +v11 = [ + (v8/*: any*/), + (v3/*: any*/) +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "NewDataViewQuery", + "selections": [ + { + "alias": "organization", + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "kind": "InlineFragment", + "selections": [ + (v2/*: any*/), + { + "args": null, + "kind": "FragmentSpread", + "name": "PeopleSelector_organization" + }, + { + "alias": "vendors", + "args": [ + (v3/*: any*/) + ], + "concreteType": "VendorConnection", + "kind": "LinkedField", + "name": "__NewDataView_vendors_connection", + "plural": false, + "selections": (v7/*: any*/), + "storageKey": "__NewDataView_vendors_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"NAME\"})" + } + ], + "type": "Organization", + "abstractKey": null + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "NewDataViewQuery", + "selections": [ + { + "alias": "organization", + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v4/*: any*/), + (v2/*: any*/), + { + "kind": "InlineFragment", + "selections": [ + { + "alias": null, + "args": (v9/*: any*/), + "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": [ + (v2/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "primaryEmailAddress", + "storageKey": null + }, + (v4/*: any*/) + ], + "storageKey": null + }, + (v5/*: any*/) + ], + "storageKey": null + }, + (v6/*: any*/) + ], + "storageKey": "peoples(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"FULL_NAME\"})" + }, + { + "alias": null, + "args": (v9/*: any*/), + "filters": (v10/*: any*/), + "handle": "connection", + "key": "PeopleSelector_organization_peoples", + "kind": "LinkedHandle", + "name": "peoples" + }, + { + "alias": null, + "args": (v11/*: any*/), + "concreteType": "VendorConnection", + "kind": "LinkedField", + "name": "vendors", + "plural": false, + "selections": (v7/*: any*/), + "storageKey": "vendors(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"NAME\"})" + }, + { + "alias": null, + "args": (v11/*: any*/), + "filters": (v10/*: any*/), + "handle": "connection", + "key": "NewDataView_vendors", + "kind": "LinkedHandle", + "name": "vendors" + } + ], + "type": "Organization", + "abstractKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "386de40f8cc3fefc6ea7b1c2778fbf7f", + "id": null, + "metadata": { + "connection": [ + { + "count": null, + "cursor": null, + "direction": "forward", + "path": [ + "organization", + "vendors" + ] + } + ] + }, + "name": "NewDataViewQuery", + "operationKind": "query", + "text": "query NewDataViewQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n ...PeopleSelector_organization\n vendors(first: 100, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n" + } +}; +})(); + +(node as any).hash = "17417e2e06c3635f2232e3a379718e4e"; + +export default node; diff --git a/apps/console/src/pages/organizations/data/__generated__/NewDatumViewCreateDatumMutation.graphql.ts b/apps/console/src/pages/organizations/data/__generated__/NewDatumViewCreateDatumMutation.graphql.ts new file mode 100644 index 000000000..13758a432 --- /dev/null +++ b/apps/console/src/pages/organizations/data/__generated__/NewDatumViewCreateDatumMutation.graphql.ts @@ -0,0 +1,247 @@ +/** + * @generated SignedSource<<5b93fe65ad69563bbcb6e75d0b913eb8>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +export type DataSensitivity = "CRITICAL" | "HIGH" | "LOW" | "MEDIUM" | "NONE"; +export type CreateDatumInput = { + dataSensitivity: DataSensitivity; + name: string; + organizationId: string; + ownerId: string; + vendorIds?: ReadonlyArray | null | undefined; +}; +export type NewDatumViewCreateDatumMutation$variables = { + connections: ReadonlyArray; + input: CreateDatumInput; +}; +export type NewDatumViewCreateDatumMutation$data = { + readonly createDatum: { + readonly datumEdge: { + readonly node: { + readonly dataSensitivity: DataSensitivity; + readonly id: string; + readonly name: string; + readonly owner: { + readonly fullName: string; + readonly id: string; + }; + readonly vendors: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + readonly name: string; + }; + }>; + }; + }; + }; + }; +}; +export type NewDatumViewCreateDatumMutation = { + response: NewDatumViewCreateDatumMutation$data; + variables: NewDatumViewCreateDatumMutation$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "connections" +}, +v1 = { + "defaultValue": null, + "kind": "LocalArgument", + "name": "input" +}, +v2 = [ + { + "kind": "Variable", + "name": "input", + "variableName": "input" + } +], +v3 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v4 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null +}, +v5 = { + "alias": null, + "args": null, + "concreteType": "DatumEdge", + "kind": "LinkedField", + "name": "datumEdge", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "Datum", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v3/*: any*/), + (v4/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "dataSensitivity", + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "People", + "kind": "LinkedField", + "name": "owner", + "plural": false, + "selections": [ + (v3/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + } + ], + "storageKey": null + }, + { + "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": [ + (v3/*: any*/), + (v4/*: any*/) + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null + } + ], + "storageKey": null +}; +return { + "fragment": { + "argumentDefinitions": [ + (v0/*: any*/), + (v1/*: any*/) + ], + "kind": "Fragment", + "metadata": null, + "name": "NewDatumViewCreateDatumMutation", + "selections": [ + { + "alias": null, + "args": (v2/*: any*/), + "concreteType": "CreateDatumPayload", + "kind": "LinkedField", + "name": "createDatum", + "plural": false, + "selections": [ + (v5/*: any*/) + ], + "storageKey": null + } + ], + "type": "Mutation", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": [ + (v1/*: any*/), + (v0/*: any*/) + ], + "kind": "Operation", + "name": "NewDatumViewCreateDatumMutation", + "selections": [ + { + "alias": null, + "args": (v2/*: any*/), + "concreteType": "CreateDatumPayload", + "kind": "LinkedField", + "name": "createDatum", + "plural": false, + "selections": [ + (v5/*: any*/), + { + "alias": null, + "args": null, + "filters": null, + "handle": "prependEdge", + "key": "", + "kind": "LinkedHandle", + "name": "datumEdge", + "handleArgs": [ + { + "kind": "Variable", + "name": "connections", + "variableName": "connections" + } + ] + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "0ab550803b091f5dfa1935f810eaecdc", + "id": null, + "metadata": {}, + "name": "NewDatumViewCreateDatumMutation", + "operationKind": "mutation", + "text": "mutation NewDatumViewCreateDatumMutation(\n $input: CreateDatumInput!\n) {\n createDatum(input: $input) {\n datumEdge {\n node {\n id\n name\n dataSensitivity\n owner {\n id\n fullName\n }\n vendors {\n edges {\n node {\n id\n name\n }\n }\n }\n }\n }\n }\n}\n" + } +}; +})(); + +(node as any).hash = "697a260fb7d44115c617682d38b9259d"; + +export default node; diff --git a/apps/console/src/pages/organizations/data/__generated__/NewDatumViewQuery.graphql.ts b/apps/console/src/pages/organizations/data/__generated__/NewDatumViewQuery.graphql.ts new file mode 100644 index 000000000..b7edbccaf --- /dev/null +++ b/apps/console/src/pages/organizations/data/__generated__/NewDatumViewQuery.graphql.ts @@ -0,0 +1,341 @@ +/** + * @generated SignedSource<<97b293f05983c20bdca4d72f53f44f2c>> + * @lightSyntaxTransform + * @nogrep + */ + +/* tslint:disable */ +/* eslint-disable */ +// @ts-nocheck + +import { ConcreteRequest } from 'relay-runtime'; +import { FragmentRefs } from "relay-runtime"; +export type NewDatumViewQuery$variables = { + organizationId: string; +}; +export type NewDatumViewQuery$data = { + readonly organization: { + readonly id?: string; + readonly vendors?: { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + readonly name: string; + }; + }>; + }; + readonly " $fragmentSpreads": FragmentRefs<"PeopleSelector_organization">; + }; +}; +export type NewDatumViewQuery = { + response: NewDatumViewQuery$data; + variables: NewDatumViewQuery$variables; +}; + +const node: ConcreteRequest = (function(){ +var v0 = [ + { + "defaultValue": null, + "kind": "LocalArgument", + "name": "organizationId" + } +], +v1 = [ + { + "kind": "Variable", + "name": "id", + "variableName": "organizationId" + } +], +v2 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "id", + "storageKey": null +}, +v3 = { + "kind": "Literal", + "name": "orderBy", + "value": { + "direction": "ASC", + "field": "NAME" + } +}, +v4 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "__typename", + "storageKey": null +}, +v5 = { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "cursor", + "storageKey": null +}, +v6 = { + "alias": null, + "args": null, + "concreteType": "PageInfo", + "kind": "LinkedField", + "name": "pageInfo", + "plural": false, + "selections": [ + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "endCursor", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "hasNextPage", + "storageKey": null + } + ], + "storageKey": null +}, +v7 = [ + { + "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": [ + (v2/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "name", + "storageKey": null + }, + (v4/*: any*/) + ], + "storageKey": null + }, + (v5/*: any*/) + ], + "storageKey": null + }, + (v6/*: any*/) +], +v8 = { + "kind": "Literal", + "name": "first", + "value": 100 +}, +v9 = [ + (v8/*: any*/), + { + "kind": "Literal", + "name": "orderBy", + "value": { + "direction": "ASC", + "field": "FULL_NAME" + } + } +], +v10 = [ + "orderBy" +], +v11 = [ + (v8/*: any*/), + (v3/*: any*/) +]; +return { + "fragment": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Fragment", + "metadata": null, + "name": "NewDatumViewQuery", + "selections": [ + { + "alias": "organization", + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + { + "kind": "InlineFragment", + "selections": [ + (v2/*: any*/), + { + "args": null, + "kind": "FragmentSpread", + "name": "PeopleSelector_organization" + }, + { + "alias": "vendors", + "args": [ + (v3/*: any*/) + ], + "concreteType": "VendorConnection", + "kind": "LinkedField", + "name": "__NewDatumView_vendors_connection", + "plural": false, + "selections": (v7/*: any*/), + "storageKey": "__NewDatumView_vendors_connection(orderBy:{\"direction\":\"ASC\",\"field\":\"NAME\"})" + } + ], + "type": "Organization", + "abstractKey": null + } + ], + "storageKey": null + } + ], + "type": "Query", + "abstractKey": null + }, + "kind": "Request", + "operation": { + "argumentDefinitions": (v0/*: any*/), + "kind": "Operation", + "name": "NewDatumViewQuery", + "selections": [ + { + "alias": "organization", + "args": (v1/*: any*/), + "concreteType": null, + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v4/*: any*/), + (v2/*: any*/), + { + "kind": "InlineFragment", + "selections": [ + { + "alias": null, + "args": (v9/*: any*/), + "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": [ + (v2/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "fullName", + "storageKey": null + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "primaryEmailAddress", + "storageKey": null + }, + (v4/*: any*/) + ], + "storageKey": null + }, + (v5/*: any*/) + ], + "storageKey": null + }, + (v6/*: any*/) + ], + "storageKey": "peoples(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"FULL_NAME\"})" + }, + { + "alias": null, + "args": (v9/*: any*/), + "filters": (v10/*: any*/), + "handle": "connection", + "key": "PeopleSelector_organization_peoples", + "kind": "LinkedHandle", + "name": "peoples" + }, + { + "alias": null, + "args": (v11/*: any*/), + "concreteType": "VendorConnection", + "kind": "LinkedField", + "name": "vendors", + "plural": false, + "selections": (v7/*: any*/), + "storageKey": "vendors(first:100,orderBy:{\"direction\":\"ASC\",\"field\":\"NAME\"})" + }, + { + "alias": null, + "args": (v11/*: any*/), + "filters": (v10/*: any*/), + "handle": "connection", + "key": "NewDatumView_vendors", + "kind": "LinkedHandle", + "name": "vendors" + } + ], + "type": "Organization", + "abstractKey": null + } + ], + "storageKey": null + } + ] + }, + "params": { + "cacheID": "e698a32ef470814abd17efa109d9fd77", + "id": null, + "metadata": { + "connection": [ + { + "count": null, + "cursor": null, + "direction": "forward", + "path": [ + "organization", + "vendors" + ] + } + ] + }, + "name": "NewDatumViewQuery", + "operationKind": "query", + "text": "query NewDatumViewQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n ...PeopleSelector_organization\n vendors(first: 100, orderBy: {direction: ASC, field: NAME}) {\n edges {\n node {\n id\n name\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n }\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100, orderBy: {direction: ASC, field: FULL_NAME}) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n" + } +}; +})(); + +(node as any).hash = "a6494c9c32546d64609c7be15620f9c9"; + +export default node; diff --git a/pkg/coredata/data.go b/pkg/coredata/data.go new file mode 100644 index 000000000..14cb10d1c --- /dev/null +++ b/pkg/coredata/data.go @@ -0,0 +1,435 @@ +// Copyright (c) 2025 Probo Inc . +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +package coredata + +import ( + "context" + "fmt" + "maps" + "time" + + "github.com/getprobo/probo/pkg/gid" + "github.com/getprobo/probo/pkg/page" + "github.com/jackc/pgx/v5" + "go.gearno.de/kit/pg" +) + +type Data struct { + ID gid.GID `db:"id"` + Name string `db:"name"` + OrganizationID gid.GID `db:"organization_id"` + OwnerID gid.GID `db:"owner_id"` + DataSensitivity DataSensitivity `db:"data_sensitivity"` + CreatedAt time.Time `db:"created_at"` + UpdatedAt time.Time `db:"updated_at"` +} + +func (d *Data) CursorKey(field DatumOrderField) page.CursorKey { + switch field { + case DatumOrderFieldCreatedAt: + return page.NewCursorKey(d.ID, d.CreatedAt) + case DatumOrderFieldName: + return page.NewCursorKey(d.ID, d.Name) + case DatumOrderFieldDataSensitivity: + return page.NewCursorKey(d.ID, d.DataSensitivity) + } + + panic(fmt.Sprintf("unsupported order by: %s", field)) +} + +type DataList []*Data + +func (d *Data) LoadByID( + ctx context.Context, + conn pg.Conn, + scope Scoper, + dataID gid.GID, +) error { + q := ` +SELECT + id, + name, + owner_id, + organization_id, + data_sensitivity, + created_at, + updated_at +FROM + data +WHERE + %s + AND id = @data_id +LIMIT 1; +` + + q = fmt.Sprintf(q, scope.SQLFragment()) + + args := pgx.StrictNamedArgs{"data_id": dataID} + maps.Copy(args, scope.SQLArguments()) + + rows, err := conn.Query(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot query data: %w", err) + } + + data, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[Data]) + if err != nil { + return fmt.Errorf("cannot collect data: %w", err) + } + + *d = data + + return nil +} + +func (d *Data) LoadByOwnerID( + ctx context.Context, + conn pg.Conn, + scope Scoper, +) error { + q := ` +SELECT + id, + name, + owner_id, + organization_id, + data_sensitivity, + created_at, + updated_at +FROM + data +WHERE + %s + AND owner_id = @owner_id +LIMIT 1; +` + + q = fmt.Sprintf(q, scope.SQLFragment()) + + args := pgx.StrictNamedArgs{"owner_id": d.OwnerID} + maps.Copy(args, scope.SQLArguments()) + + rows, err := conn.Query(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot query data: %w", err) + } + + data, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[Data]) + if err != nil { + return fmt.Errorf("cannot collect data: %w", err) + } + + *d = data + + return nil +} + +func (dl *DataList) LoadByOwnerID( + ctx context.Context, + conn pg.Conn, + scope Scoper, + ownerID gid.GID, + cursor *page.Cursor[DatumOrderField], +) error { + q := ` +SELECT + id, + name, + owner_id, + data_sensitivity, + created_at, + updated_at +FROM + data +WHERE + %s + AND owner_id = @owner_id + AND %s +` + + q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment()) + + args := pgx.StrictNamedArgs{"owner_id": ownerID} + maps.Copy(args, scope.SQLArguments()) + maps.Copy(args, cursor.SQLArguments()) + + rows, err := conn.Query(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot query data: %w", err) + } + + data, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[Data]) + if err != nil { + return fmt.Errorf("cannot collect data: %w", err) + } + + *dl = data + + return nil +} + +func (dl *DataList) LoadByOrganizationID( + ctx context.Context, + conn pg.Conn, + scope Scoper, + organizationID gid.GID, + cursor *page.Cursor[DatumOrderField], +) error { + q := ` +SELECT + id, + name, + organization_id, + owner_id, + data_sensitivity, + created_at, + updated_at +FROM + data +WHERE + %s + AND organization_id = @organization_id + AND %s +` + + q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment()) + + args := pgx.StrictNamedArgs{"organization_id": organizationID} + maps.Copy(args, scope.SQLArguments()) + maps.Copy(args, cursor.SQLArguments()) + + rows, err := conn.Query(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot query data: %w", err) + } + + data, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[Data]) + if err != nil { + return fmt.Errorf("cannot collect data: %w", err) + } + + *dl = data + + return nil +} + +func (d *Data) Insert( + ctx context.Context, + conn pg.Conn, + scope Scoper, +) error { + q := ` +INSERT INTO data ( + id, + tenant_id, + name, + owner_id, + organization_id, + data_sensitivity, + created_at, + updated_at +) VALUES ( + @id, + @tenant_id, + @name, + @owner_id, + @organization_id, + @data_sensitivity, + @created_at, + @updated_at +) +` + + args := pgx.StrictNamedArgs{ + "id": d.ID, + "tenant_id": scope.GetTenantID(), + "name": d.Name, + "owner_id": d.OwnerID, + "organization_id": d.OrganizationID, + "data_sensitivity": d.DataSensitivity, + "created_at": d.CreatedAt, + "updated_at": d.UpdatedAt, + } + + _, err := conn.Exec(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot insert data: %w", err) + } + + return nil +} + +func (d *Data) Update( + ctx context.Context, + conn pg.Conn, + scope Scoper, +) error { + q := ` +UPDATE data +SET + name = @name, + owner_id = @owner_id, + data_sensitivity = @data_sensitivity, + updated_at = @updated_at +WHERE + %s + AND id = @id +RETURNING + id, + name, + owner_id, + organization_id, + data_sensitivity, + created_at, + updated_at +` + + q = fmt.Sprintf(q, scope.SQLFragment()) + + args := pgx.StrictNamedArgs{ + "id": d.ID, + "name": d.Name, + "owner_id": d.OwnerID, + "data_sensitivity": d.DataSensitivity, + "updated_at": time.Now(), + } + maps.Copy(args, scope.SQLArguments()) + + rows, err := conn.Query(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot update data: %w", err) + } + + data, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[Data]) + if err != nil { + return fmt.Errorf("cannot collect updated data: %w", err) + } + + *d = data + + return nil +} + +func (d *Data) Delete( + ctx context.Context, + conn pg.Conn, + scope Scoper, +) error { + q := ` +DELETE FROM data +WHERE + %s + AND id = @id +` + + q = fmt.Sprintf(q, scope.SQLFragment()) + + args := pgx.StrictNamedArgs{"id": d.ID} + maps.Copy(args, scope.SQLArguments()) + + _, err := conn.Exec(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot delete data: %w", err) + } + + return nil +} + +type DataVendor struct { + DataID gid.GID `db:"data_id"` + VendorID gid.GID `db:"vendor_id"` + CreatedAt time.Time `db:"created_at"` +} + +func (d *Data) CreateWithVendors( + ctx context.Context, + conn pg.Conn, + scope Scoper, + vendorIDs []gid.GID, + now time.Time, +) error { + if err := d.Insert(ctx, conn, scope); err != nil { + return fmt.Errorf("cannot insert data: %w", err) + } + + if len(vendorIDs) > 0 { + for _, vendorID := range vendorIDs { + _, err := conn.Exec(ctx, ` + INSERT INTO data_vendors (tenant_id, datum_id, vendor_id, created_at) + VALUES ($1, $2, $3, $4) + `, scope.GetTenantID(), d.ID, vendorID, now) + if err != nil { + return fmt.Errorf("cannot insert data vendor: %w", err) + } + } + } + + return nil +} + +func (d *Data) UpdateWithVendors( + ctx context.Context, + conn pg.Conn, + scope Scoper, + vendorIDs []gid.GID, + now time.Time, +) error { + existing := &Data{} + if err := existing.LoadByID(ctx, conn, scope, d.ID); err != nil { + return fmt.Errorf("cannot load data: %w", err) + } + + d.CreatedAt = existing.CreatedAt + d.UpdatedAt = now + + if err := d.Update(ctx, conn, scope); err != nil { + return fmt.Errorf("cannot update data: %w", err) + } + + _, err := conn.Exec(ctx, ` + DELETE FROM data_vendors + WHERE tenant_id = $1 AND datum_id = $2 + `, scope.GetTenantID(), d.ID) + if err != nil { + return fmt.Errorf("cannot delete data vendors: %w", err) + } + + if len(vendorIDs) > 0 { + for _, vendorID := range vendorIDs { + _, err := conn.Exec(ctx, ` + INSERT INTO data_vendors (tenant_id, datum_id, vendor_id, created_at) + VALUES ($1, $2, $3, $4) + `, scope.GetTenantID(), d.ID, vendorID, now) + if err != nil { + return fmt.Errorf("cannot insert data vendor: %w", err) + } + } + } + + return nil +} + +// UpdateWithVendorsTx updates a data entry and its vendor relationships in a single transaction +func (d *Data) UpdateWithVendorsTx( + ctx context.Context, + db *pg.Client, + scope Scoper, + vendorIDs []gid.GID, + now time.Time, +) error { + return db.WithTx(ctx, func(conn pg.Conn) error { + return d.UpdateWithVendors(ctx, conn, scope, vendorIDs, now) + }) +} diff --git a/pkg/coredata/datum_order_field.go b/pkg/coredata/datum_order_field.go new file mode 100644 index 000000000..ad36a7e4a --- /dev/null +++ b/pkg/coredata/datum_order_field.go @@ -0,0 +1,51 @@ +// Copyright (c) 2025 Probo Inc . +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +package coredata + +import ( + "fmt" +) + +type DatumOrderField string + +const ( + DatumOrderFieldCreatedAt DatumOrderField = "CREATED_AT" + DatumOrderFieldName DatumOrderField = "NAME" + DatumOrderFieldDataSensitivity DatumOrderField = "DATA_SENSITIVITY" +) + +func (p DatumOrderField) Column() string { + return string(p) +} + +func (p DatumOrderField) String() string { + return string(p) +} + +func (p DatumOrderField) MarshalText() ([]byte, error) { + return []byte(p.String()), nil +} + +func (p *DatumOrderField) UnmarshalText(text []byte) error { + val := string(text) + switch val { + case string(DatumOrderFieldCreatedAt), + string(DatumOrderFieldName), + string(DatumOrderFieldDataSensitivity): + *p = DatumOrderField(val) + return nil + } + return fmt.Errorf("invalid DatumOrderField value: %q", val) +} diff --git a/pkg/coredata/entity_type_reg.go b/pkg/coredata/entity_type_reg.go index e61c9faf0..2850b77ab 100644 --- a/pkg/coredata/entity_type_reg.go +++ b/pkg/coredata/entity_type_reg.go @@ -34,4 +34,5 @@ const ( DocumentVersionEntityType DocumentVersionSignatureEntityType AssetEntityType + DatumEntityType ) diff --git a/pkg/coredata/migrations/20250602T225034Z.sql b/pkg/coredata/migrations/20250602T225034Z.sql new file mode 100644 index 000000000..a9b046b4a --- /dev/null +++ b/pkg/coredata/migrations/20250602T225034Z.sql @@ -0,0 +1,20 @@ +-- Create data table +CREATE TABLE data ( + id TEXT PRIMARY KEY, + tenant_id TEXT NOT NULL, + name TEXT NOT NULL, + data_sensitivity data_sensitivity NOT NULL, + organization_id TEXT NOT NULL REFERENCES organizations(id) ON DELETE RESTRICT, + owner_id TEXT NOT NULL REFERENCES peoples(id) ON DELETE RESTRICT, + created_at TIMESTAMP WITH TIME ZONE NOT NULL, + updated_at TIMESTAMP WITH TIME ZONE NOT NULL +); + +-- Create junction table for many-to-many relationship with vendors +CREATE TABLE data_vendors ( + datum_id TEXT NOT NULL REFERENCES data(id) ON DELETE CASCADE, + vendor_id TEXT NOT NULL REFERENCES vendors(id) ON DELETE CASCADE, + tenant_id TEXT NOT NULL, + created_at TIMESTAMP WITH TIME ZONE NOT NULL, + PRIMARY KEY (datum_id, vendor_id) +); diff --git a/pkg/coredata/organization_order_field.go b/pkg/coredata/organization_order_field.go index ea4976d42..b9a5699c3 100644 --- a/pkg/coredata/organization_order_field.go +++ b/pkg/coredata/organization_order_field.go @@ -19,7 +19,9 @@ type ( ) const ( + OrganizationOrderFieldName OrganizationOrderField = "NAME" OrganizationOrderFieldCreatedAt OrganizationOrderField = "CREATED_AT" + OrganizationOrderFieldUpdatedAt OrganizationOrderField = "UPDATED_AT" ) func (p OrganizationOrderField) Column() string { diff --git a/pkg/coredata/vendor.go b/pkg/coredata/vendor.go index a69d4a51e..7d9196e50 100644 --- a/pkg/coredata/vendor.go +++ b/pkg/coredata/vendor.go @@ -461,7 +461,7 @@ WHERE %s ` q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment()) - args := pgx.NamedArgs{"asset_id": assetID} + args := pgx.StrictNamedArgs{"asset_id": assetID} maps.Copy(args, scope.SQLArguments()) maps.Copy(args, cursor.SQLArguments()) @@ -479,3 +479,93 @@ WHERE %s return nil } + +func (vs *Vendors) LoadByDatumID( + ctx context.Context, + conn pg.Conn, + scope Scoper, + datumID gid.GID, + cursor *page.Cursor[VendorOrderField], +) error { + q := ` +WITH vend AS ( + SELECT + v.id, + v.tenant_id, + v.organization_id, + v.name, + v.description, + v.category, + v.headquarter_address, + v.legal_name, + v.website_url, + v.privacy_policy_url, + v.service_level_agreement_url, + v.data_processing_agreement_url, + v.business_associate_agreement_url, + v.subprocessors_list_url, + v.certifications, + v.business_owner_id, + v.security_owner_id, + v.status_page_url, + v.terms_of_service_url, + v.security_page_url, + v.trust_page_url, + v.created_at, + v.updated_at + FROM + vendors v + INNER JOIN + data_vendors dv ON v.id = dv.vendor_id + WHERE + dv.datum_id = @datum_id +) +SELECT + id, + tenant_id, + organization_id, + name, + description, + category, + headquarter_address, + legal_name, + website_url, + privacy_policy_url, + service_level_agreement_url, + data_processing_agreement_url, + business_associate_agreement_url, + subprocessors_list_url, + certifications, + business_owner_id, + security_owner_id, + status_page_url, + terms_of_service_url, + security_page_url, + trust_page_url, + created_at, + updated_at +FROM + vend +WHERE %s + AND %s +` + q = fmt.Sprintf(q, scope.SQLFragment(), cursor.SQLFragment()) + + args := pgx.StrictNamedArgs{"datum_id": datumID} + maps.Copy(args, scope.SQLArguments()) + maps.Copy(args, cursor.SQLArguments()) + + rows, err := conn.Query(ctx, q, args) + if err != nil { + return fmt.Errorf("cannot query vendors: %w", err) + } + + vendors, err := pgx.CollectRows(rows, pgx.RowToAddrOfStructByName[Vendor]) + if err != nil { + return fmt.Errorf("cannot collect vendors: %w", err) + } + + *vs = vendors + + return nil +} diff --git a/pkg/probo/datum_service.go b/pkg/probo/datum_service.go new file mode 100644 index 000000000..dd2614840 --- /dev/null +++ b/pkg/probo/datum_service.go @@ -0,0 +1,247 @@ +// Copyright (c) 2025 Probo Inc . +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +package probo + +import ( + "context" + "fmt" + "time" + + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/gid" + "github.com/getprobo/probo/pkg/page" + "go.gearno.de/kit/pg" +) + +type DatumService struct { + svc *TenantService +} + +type CreateDatumRequest struct { + OrganizationID gid.GID + Name string + DataSensitivity coredata.DataSensitivity + OwnerID gid.GID + VendorIDs []gid.GID +} + +type UpdateDatumRequest struct { + ID gid.GID + Name *string + DataSensitivity *coredata.DataSensitivity + OwnerID *gid.GID + VendorIDs []gid.GID +} + +func (s DatumService) Get( + ctx context.Context, + datumID gid.GID, +) (*coredata.Data, error) { + datum := &coredata.Data{} + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + return datum.LoadByID(ctx, conn, s.svc.scope, datumID) + }, + ) + + if err != nil { + return nil, err + } + + return datum, nil +} + +func (s DatumService) GetByOwnerID( + ctx context.Context, + ownerID gid.GID, +) (*coredata.Data, error) { + datum := &coredata.Data{OwnerID: ownerID} + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + return datum.LoadByOwnerID(ctx, conn, s.svc.scope) + }, + ) + + if err != nil { + return nil, err + } + + return datum, nil +} + +func (s DatumService) ListForOrganizationID( + ctx context.Context, + organizationID gid.GID, + cursor *page.Cursor[coredata.DatumOrderField], +) (*page.Page[*coredata.Data, coredata.DatumOrderField], error) { + var data coredata.DataList + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + return data.LoadByOrganizationID( + ctx, + conn, + s.svc.scope, + organizationID, + cursor, + ) + }, + ) + + if err != nil { + return nil, err + } + + return page.NewPage(data, cursor), nil +} + +func (s DatumService) Update( + ctx context.Context, + req UpdateDatumRequest, +) (*coredata.Data, error) { + now := time.Now() + + existing := &coredata.Data{} + if err := s.svc.pg.WithConn(ctx, func(conn pg.Conn) error { + return existing.LoadByID(ctx, conn, s.svc.scope, req.ID) + }); err != nil { + return nil, fmt.Errorf("cannot load data: %w", err) + } + + datum := &coredata.Data{ + ID: req.ID, + OrganizationID: existing.OrganizationID, + Name: existing.Name, + DataSensitivity: existing.DataSensitivity, + OwnerID: existing.OwnerID, + CreatedAt: existing.CreatedAt, + UpdatedAt: now, + } + + // Update fields from request + if req.Name != nil { + datum.Name = *req.Name + } + if req.DataSensitivity != nil { + datum.DataSensitivity = *req.DataSensitivity + } + if req.OwnerID != nil { + datum.OwnerID = *req.OwnerID + } + + if err := datum.UpdateWithVendorsTx(ctx, s.svc.pg, s.svc.scope, req.VendorIDs, now); err != nil { + return nil, err + } + + return datum, nil +} + +func (s DatumService) Create( + ctx context.Context, + req CreateDatumRequest, +) (*coredata.Data, error) { + now := time.Now() + datumID := gid.New(s.svc.scope.GetTenantID(), coredata.DatumEntityType) + + datum := &coredata.Data{ + ID: datumID, + OrganizationID: req.OrganizationID, + Name: req.Name, + DataSensitivity: req.DataSensitivity, + OwnerID: req.OwnerID, + CreatedAt: now, + UpdatedAt: now, + } + + err := s.svc.pg.WithTx( + ctx, + func(conn pg.Conn) error { + return datum.CreateWithVendors(ctx, conn, s.svc.scope, req.VendorIDs, now) + }, + ) + + if err != nil { + return nil, err + } + + return datum, nil +} + +func (s DatumService) Delete( + ctx context.Context, + datumID gid.GID, +) error { + datum := &coredata.Data{ID: datumID} + + return s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + return datum.Delete(ctx, conn, s.svc.scope) + }, + ) +} + +func (s DatumService) ListVendors( + ctx context.Context, + datumID gid.GID, + cursor *page.Cursor[coredata.VendorOrderField], +) (*page.Page[*coredata.Vendor, coredata.VendorOrderField], error) { + var vendors coredata.Vendors + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + return vendors.LoadByDatumID(ctx, conn, s.svc.scope, datumID, cursor) + }, + ) + + if err != nil { + return nil, err + } + + return page.NewPage(vendors, cursor), nil +} + +func (s VendorService) ListForDatumID( + ctx context.Context, + datumID gid.GID, + cursor *page.Cursor[coredata.VendorOrderField], +) (*page.Page[*coredata.Vendor, coredata.VendorOrderField], error) { + var vendors coredata.Vendors + + err := s.svc.pg.WithConn( + ctx, + func(conn pg.Conn) error { + return vendors.LoadByDatumID( + ctx, + conn, + s.svc.scope, + datumID, + cursor, + ) + }, + ) + + if err != nil { + return nil, err + } + + return page.NewPage(vendors, cursor), nil +} diff --git a/pkg/probo/service.go b/pkg/probo/service.go index f4be067d3..f801453d2 100644 --- a/pkg/probo/service.go +++ b/pkg/probo/service.go @@ -60,6 +60,7 @@ type ( VendorComplianceReports *VendorComplianceReportService Connectors *ConnectorService Assets *AssetService + Data *DatumService } ) @@ -131,5 +132,6 @@ func (s *Service) WithTenant(tenantID gid.TenantID) *TenantService { tenantService.VendorComplianceReports = &VendorComplianceReportService{svc: tenantService} tenantService.Connectors = &ConnectorService{svc: tenantService} tenantService.Assets = &AssetService{svc: tenantService} + tenantService.Data = &DatumService{svc: tenantService} return tenantService } diff --git a/pkg/server/api/console/v1/schema.graphql b/pkg/server/api/console/v1/schema.graphql index 4822a194d..601c0d49f 100644 --- a/pkg/server/api/console/v1/schema.graphql +++ b/pkg/server/api/console/v1/schema.graphql @@ -245,10 +245,10 @@ enum VendorComplianceReportOrderField ) } -enum OrganizationOrderField { - NAME - CREATED_AT - UPDATED_AT +enum OrganizationOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderField") { + NAME @goEnum(value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldName") + CREATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldCreatedAt") + UPDATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldUpdatedAt") } enum ConnectorOrderField @@ -360,6 +360,12 @@ enum AssetOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.Ass CRITICITY @goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldCriticity") } +enum DatumOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.DatumOrderField") { + CREATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldCreatedAt") + NAME @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldName") + DATA_SENSITIVITY @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldDataSensitivity") +} + # Order Input Types input UserOrder @goModel( @@ -557,6 +563,14 @@ type Organization implements Node { orderBy: AssetOrder ): AssetConnection! @goField(forceResolver: true) + data( + first: Int + after: CursorKey + last: Int + before: CursorKey + orderBy: DatumOrder + ): DatumConnection! @goField(forceResolver: true) + createdAt: Datetime! updatedAt: Datetime! } @@ -1023,6 +1037,16 @@ type DocumentVersionEdge { node: DocumentVersion! } +type DatumConnection { + edges: [DatumEdge!]! + pageInfo: PageInfo! +} + +type DatumEdge { + cursor: CursorKey! + node: Datum! +} + # Root Types type Query { node(id: ID!): Node! @@ -1157,6 +1181,12 @@ type Mutation { deleteAsset(input: DeleteAssetInput!): DeleteAssetPayload! addAssetVendor(input: AddAssetVendorInput!): AddAssetVendorPayload! removeAssetVendor(input: RemoveAssetVendorInput!): RemoveAssetVendorPayload! + + createDatum(input: CreateDatumInput!): CreateDatumPayload! + updateDatum(input: UpdateDatumInput!): UpdateDatumPayload! + deleteDatum(input: DeleteDatumInput!): DeleteDatumPayload! + addDatumVendor(input: AddDatumVendorInput!): AddDatumVendorPayload! + removeDatumVendor(input: RemoveDatumVendorInput!): RemoveDatumVendorPayload! } # Input Types @@ -1954,3 +1984,75 @@ type AddAssetVendorPayload { type RemoveAssetVendorPayload { asset: Asset! } + +type Datum implements Node { + id: ID! + name: String! + dataSensitivity: DataSensitivity! + owner: People! @goField(forceResolver: true) + vendors( + first: Int + after: CursorKey + last: Int + before: CursorKey + orderBy: VendorOrder + ): VendorConnection! @goField(forceResolver: true) + organization: Organization! @goField(forceResolver: true) + createdAt: Datetime! + updatedAt: Datetime! +} + +input DatumOrder { + direction: OrderDirection! + field: DatumOrderField! +} + +input CreateDatumInput { + organizationId: ID! + name: String! + dataSensitivity: DataSensitivity! + ownerId: ID! + vendorIds: [ID!] +} + +input UpdateDatumInput { + id: ID! + name: String + dataSensitivity: DataSensitivity + ownerId: ID + vendorIds: [ID!] +} + +input DeleteDatumInput { + datumId: ID! +} + +input AddDatumVendorInput { + datumId: ID! + vendorId: ID! +} + +input RemoveDatumVendorInput { + datumId: ID! + vendorId: ID! +} + +type CreateDatumPayload { + datumEdge: DatumEdge! +} + +type UpdateDatumPayload { + datum: Datum! +} + +type DeleteDatumPayload { + deletedDatumId: ID! +} + +type AddDatumVendorPayload { + datum: Datum! +} + +type RemoveDatumVendorPayload { + datum: Datum! +} diff --git a/pkg/server/api/console/v1/schema/schema.go b/pkg/server/api/console/v1/schema/schema.go index 5d5e47526..285584dab 100644 --- a/pkg/server/api/console/v1/schema/schema.go +++ b/pkg/server/api/console/v1/schema/schema.go @@ -44,6 +44,7 @@ type Config struct { type ResolverRoot interface { Asset() AssetResolver Control() ControlResolver + Datum() DatumResolver Document() DocumentResolver DocumentVersion() DocumentVersionResolver DocumentVersionSignature() DocumentVersionSignatureResolver @@ -70,6 +71,10 @@ type ComplexityRoot struct { Asset func(childComplexity int) int } + AddDatumVendorPayload struct { + Datum func(childComplexity int) int + } + AssessVendorPayload struct { Vendor func(childComplexity int) int } @@ -160,6 +165,10 @@ type ComplexityRoot struct { MeasureEdge func(childComplexity int) int } + CreateDatumPayload struct { + DatumEdge func(childComplexity int) int + } + CreateDocumentPayload struct { DocumentEdge func(childComplexity int) int DocumentVersionEdge func(childComplexity int) int @@ -215,6 +224,27 @@ type ComplexityRoot struct { VendorRiskAssessmentEdge func(childComplexity int) int } + Datum struct { + CreatedAt func(childComplexity int) int + DataSensitivity func(childComplexity int) int + ID func(childComplexity int) int + Name func(childComplexity int) int + Organization func(childComplexity int) int + Owner func(childComplexity int) int + UpdatedAt func(childComplexity int) int + Vendors func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.VendorOrderBy) int + } + + DatumConnection struct { + Edges func(childComplexity int) int + PageInfo func(childComplexity int) int + } + + DatumEdge struct { + Cursor func(childComplexity int) int + Node func(childComplexity int) int + } + DeleteAssetPayload struct { DeletedAssetID func(childComplexity int) int } @@ -229,6 +259,10 @@ type ComplexityRoot struct { DeletedMeasureID func(childComplexity int) int } + DeleteDatumPayload struct { + DeletedDatumID func(childComplexity int) int + } + DeleteDocumentPayload struct { DeletedDocumentID func(childComplexity int) int } @@ -441,12 +475,14 @@ type ComplexityRoot struct { Mutation struct { AddAssetVendor func(childComplexity int, input types.AddAssetVendorInput) int + AddDatumVendor func(childComplexity int, input types.AddDatumVendorInput) int AssessVendor func(childComplexity int, input types.AssessVendorInput) int AssignTask func(childComplexity int, input types.AssignTaskInput) int ConfirmEmail func(childComplexity int, input types.ConfirmEmailInput) int CreateAsset func(childComplexity int, input types.CreateAssetInput) int CreateControlDocumentMapping func(childComplexity int, input types.CreateControlDocumentMappingInput) int CreateControlMeasureMapping func(childComplexity int, input types.CreateControlMeasureMappingInput) int + CreateDatum func(childComplexity int, input types.CreateDatumInput) int CreateDocument func(childComplexity int, input types.CreateDocumentInput) int CreateDraftDocumentVersion func(childComplexity int, input types.CreateDraftDocumentVersionInput) int CreateFramework func(childComplexity int, input types.CreateFrameworkInput) int @@ -462,6 +498,7 @@ type ComplexityRoot struct { DeleteAsset func(childComplexity int, input types.DeleteAssetInput) int DeleteControlDocumentMapping func(childComplexity int, input types.DeleteControlDocumentMappingInput) int DeleteControlMeasureMapping func(childComplexity int, input types.DeleteControlMeasureMappingInput) int + DeleteDatum func(childComplexity int, input types.DeleteDatumInput) int DeleteDocument func(childComplexity int, input types.DeleteDocumentInput) int DeleteEvidence func(childComplexity int, input types.DeleteEvidenceInput) int DeleteFramework func(childComplexity int, input types.DeleteFrameworkInput) int @@ -481,12 +518,14 @@ type ComplexityRoot struct { InviteUser func(childComplexity int, input types.InviteUserInput) int PublishDocumentVersion func(childComplexity int, input types.PublishDocumentVersionInput) int RemoveAssetVendor func(childComplexity int, input types.RemoveAssetVendorInput) int + RemoveDatumVendor func(childComplexity int, input types.RemoveDatumVendorInput) int RemoveUser func(childComplexity int, input types.RemoveUserInput) int RequestEvidence func(childComplexity int, input types.RequestEvidenceInput) int RequestSignature func(childComplexity int, input types.RequestSignatureInput) int SendSigningNotifications func(childComplexity int, input types.SendSigningNotificationsInput) int UnassignTask func(childComplexity int, input types.UnassignTaskInput) int UpdateAsset func(childComplexity int, input types.UpdateAssetInput) int + UpdateDatum func(childComplexity int, input types.UpdateDatumInput) int UpdateDocument func(childComplexity int, input types.UpdateDocumentInput) int UpdateDocumentVersion func(childComplexity int, input types.UpdateDocumentVersionInput) int UpdateFramework func(childComplexity int, input types.UpdateFrameworkInput) int @@ -505,6 +544,7 @@ type ComplexityRoot struct { Assets func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.AssetOrder) int Connectors func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ConnectorOrder) int CreatedAt func(childComplexity int) int + Data func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DatumOrder) int Documents func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentOrderBy) int Frameworks func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.FrameworkOrderBy) int ID func(childComplexity int) int @@ -573,6 +613,10 @@ type ComplexityRoot struct { Asset func(childComplexity int) int } + RemoveDatumVendorPayload struct { + Datum func(childComplexity int) int + } + RemoveUserPayload struct { Success func(childComplexity int) int } @@ -658,6 +702,10 @@ type ComplexityRoot struct { Asset func(childComplexity int) int } + UpdateDatumPayload struct { + Datum func(childComplexity int) int + } + UpdateDocumentPayload struct { Document func(childComplexity int) int } @@ -827,6 +875,11 @@ type ControlResolver interface { Measures(ctx context.Context, obj *types.Control, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.MeasureOrderBy) (*types.MeasureConnection, error) Documents(ctx context.Context, obj *types.Control, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentOrderBy) (*types.DocumentConnection, error) } +type DatumResolver interface { + Owner(ctx context.Context, obj *types.Datum) (*types.People, error) + Vendors(ctx context.Context, obj *types.Datum, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.VendorOrderBy) (*types.VendorConnection, error) + Organization(ctx context.Context, obj *types.Datum) (*types.Organization, error) +} type DocumentResolver interface { Owner(ctx context.Context, obj *types.Document) (*types.People, error) Organization(ctx context.Context, obj *types.Document) (*types.Organization, error) @@ -922,6 +975,11 @@ type MutationResolver interface { DeleteAsset(ctx context.Context, input types.DeleteAssetInput) (*types.DeleteAssetPayload, error) AddAssetVendor(ctx context.Context, input types.AddAssetVendorInput) (*types.AddAssetVendorPayload, error) RemoveAssetVendor(ctx context.Context, input types.RemoveAssetVendorInput) (*types.RemoveAssetVendorPayload, error) + CreateDatum(ctx context.Context, input types.CreateDatumInput) (*types.CreateDatumPayload, error) + UpdateDatum(ctx context.Context, input types.UpdateDatumInput) (*types.UpdateDatumPayload, error) + DeleteDatum(ctx context.Context, input types.DeleteDatumInput) (*types.DeleteDatumPayload, error) + AddDatumVendor(ctx context.Context, input types.AddDatumVendorInput) (*types.AddDatumVendorPayload, error) + RemoveDatumVendor(ctx context.Context, input types.RemoveDatumVendorInput) (*types.RemoveDatumVendorPayload, error) } type OrganizationResolver interface { LogoURL(ctx context.Context, obj *types.Organization) (*string, error) @@ -935,6 +993,7 @@ type OrganizationResolver interface { Risks(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.RiskOrderBy) (*types.RiskConnection, error) Tasks(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.TaskOrderBy) (*types.TaskConnection, error) Assets(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.AssetOrder) (*types.AssetConnection, error) + Data(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DatumOrder) (*types.DatumConnection, error) } type QueryResolver interface { Node(ctx context.Context, id gid.GID) (types.Node, error) @@ -1003,6 +1062,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.AddAssetVendorPayload.Asset(childComplexity), true + case "AddDatumVendorPayload.datum": + if e.complexity.AddDatumVendorPayload.Datum == nil { + break + } + + return e.complexity.AddDatumVendorPayload.Datum(childComplexity), true + case "AssessVendorPayload.vendor": if e.complexity.AssessVendorPayload.Vendor == nil { break @@ -1333,6 +1399,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.CreateControlMeasureMappingPayload.MeasureEdge(childComplexity), true + case "CreateDatumPayload.datumEdge": + if e.complexity.CreateDatumPayload.DatumEdge == nil { + break + } + + return e.complexity.CreateDatumPayload.DatumEdge(childComplexity), true + case "CreateDocumentPayload.documentEdge": if e.complexity.CreateDocumentPayload.DocumentEdge == nil { break @@ -1445,6 +1518,95 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.CreateVendorRiskAssessmentPayload.VendorRiskAssessmentEdge(childComplexity), true + case "Datum.createdAt": + if e.complexity.Datum.CreatedAt == nil { + break + } + + return e.complexity.Datum.CreatedAt(childComplexity), true + + case "Datum.dataSensitivity": + if e.complexity.Datum.DataSensitivity == nil { + break + } + + return e.complexity.Datum.DataSensitivity(childComplexity), true + + case "Datum.id": + if e.complexity.Datum.ID == nil { + break + } + + return e.complexity.Datum.ID(childComplexity), true + + case "Datum.name": + if e.complexity.Datum.Name == nil { + break + } + + return e.complexity.Datum.Name(childComplexity), true + + case "Datum.organization": + if e.complexity.Datum.Organization == nil { + break + } + + return e.complexity.Datum.Organization(childComplexity), true + + case "Datum.owner": + if e.complexity.Datum.Owner == nil { + break + } + + return e.complexity.Datum.Owner(childComplexity), true + + case "Datum.updatedAt": + if e.complexity.Datum.UpdatedAt == nil { + break + } + + return e.complexity.Datum.UpdatedAt(childComplexity), true + + case "Datum.vendors": + if e.complexity.Datum.Vendors == nil { + break + } + + args, err := ec.field_Datum_vendors_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Datum.Vendors(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.VendorOrderBy)), true + + case "DatumConnection.edges": + if e.complexity.DatumConnection.Edges == nil { + break + } + + return e.complexity.DatumConnection.Edges(childComplexity), true + + case "DatumConnection.pageInfo": + if e.complexity.DatumConnection.PageInfo == nil { + break + } + + return e.complexity.DatumConnection.PageInfo(childComplexity), true + + case "DatumEdge.cursor": + if e.complexity.DatumEdge.Cursor == nil { + break + } + + return e.complexity.DatumEdge.Cursor(childComplexity), true + + case "DatumEdge.node": + if e.complexity.DatumEdge.Node == nil { + break + } + + return e.complexity.DatumEdge.Node(childComplexity), true + case "DeleteAssetPayload.deletedAssetId": if e.complexity.DeleteAssetPayload.DeletedAssetID == nil { break @@ -1480,6 +1642,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.DeleteControlMeasureMappingPayload.DeletedMeasureID(childComplexity), true + case "DeleteDatumPayload.deletedDatumId": + if e.complexity.DeleteDatumPayload.DeletedDatumID == nil { + break + } + + return e.complexity.DeleteDatumPayload.DeletedDatumID(childComplexity), true + case "DeleteDocumentPayload.deletedDocumentId": if e.complexity.DeleteDocumentPayload.DeletedDocumentID == nil { break @@ -2267,6 +2436,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.AddAssetVendor(childComplexity, args["input"].(types.AddAssetVendorInput)), true + case "Mutation.addDatumVendor": + if e.complexity.Mutation.AddDatumVendor == nil { + break + } + + args, err := ec.field_Mutation_addDatumVendor_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.AddDatumVendor(childComplexity, args["input"].(types.AddDatumVendorInput)), true + case "Mutation.assessVendor": if e.complexity.Mutation.AssessVendor == nil { break @@ -2339,6 +2520,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.CreateControlMeasureMapping(childComplexity, args["input"].(types.CreateControlMeasureMappingInput)), true + case "Mutation.createDatum": + if e.complexity.Mutation.CreateDatum == nil { + break + } + + args, err := ec.field_Mutation_createDatum_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.CreateDatum(childComplexity, args["input"].(types.CreateDatumInput)), true + case "Mutation.createDocument": if e.complexity.Mutation.CreateDocument == nil { break @@ -2519,6 +2712,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.DeleteControlMeasureMapping(childComplexity, args["input"].(types.DeleteControlMeasureMappingInput)), true + case "Mutation.deleteDatum": + if e.complexity.Mutation.DeleteDatum == nil { + break + } + + args, err := ec.field_Mutation_deleteDatum_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.DeleteDatum(childComplexity, args["input"].(types.DeleteDatumInput)), true + case "Mutation.deleteDocument": if e.complexity.Mutation.DeleteDocument == nil { break @@ -2747,6 +2952,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.RemoveAssetVendor(childComplexity, args["input"].(types.RemoveAssetVendorInput)), true + case "Mutation.removeDatumVendor": + if e.complexity.Mutation.RemoveDatumVendor == nil { + break + } + + args, err := ec.field_Mutation_removeDatumVendor_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.RemoveDatumVendor(childComplexity, args["input"].(types.RemoveDatumVendorInput)), true + case "Mutation.removeUser": if e.complexity.Mutation.RemoveUser == nil { break @@ -2819,6 +3036,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Mutation.UpdateAsset(childComplexity, args["input"].(types.UpdateAssetInput)), true + case "Mutation.updateDatum": + if e.complexity.Mutation.UpdateDatum == nil { + break + } + + args, err := ec.field_Mutation_updateDatum_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Mutation.UpdateDatum(childComplexity, args["input"].(types.UpdateDatumInput)), true + case "Mutation.updateDocument": if e.complexity.Mutation.UpdateDocument == nil { break @@ -2994,6 +3223,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.Organization.CreatedAt(childComplexity), true + case "Organization.data": + if e.complexity.Organization.Data == nil { + break + } + + args, err := ec.field_Organization_data_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.Organization.Data(childComplexity, args["first"].(*int), args["after"].(*page.CursorKey), args["last"].(*int), args["before"].(*page.CursorKey), args["orderBy"].(*types.DatumOrder)), true + case "Organization.documents": if e.complexity.Organization.Documents == nil { break @@ -3312,6 +3553,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.RemoveAssetVendorPayload.Asset(childComplexity), true + case "RemoveDatumVendorPayload.datum": + if e.complexity.RemoveDatumVendorPayload.Datum == nil { + break + } + + return e.complexity.RemoveDatumVendorPayload.Datum(childComplexity), true + case "RemoveUserPayload.success": if e.complexity.RemoveUserPayload.Success == nil { break @@ -3654,6 +3902,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.UpdateAssetPayload.Asset(childComplexity), true + case "UpdateDatumPayload.datum": + if e.complexity.UpdateDatumPayload.Datum == nil { + break + } + + return e.complexity.UpdateDatumPayload.Datum(childComplexity), true + case "UpdateDocumentPayload.document": if e.complexity.UpdateDocumentPayload.Document == nil { break @@ -4243,6 +4498,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputAddAssetVendorInput, + ec.unmarshalInputAddDatumVendorInput, ec.unmarshalInputAssessVendorInput, ec.unmarshalInputAssetOrder, ec.unmarshalInputAssignTaskInput, @@ -4252,6 +4508,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputCreateAssetInput, ec.unmarshalInputCreateControlDocumentMappingInput, ec.unmarshalInputCreateControlMeasureMappingInput, + ec.unmarshalInputCreateDatumInput, ec.unmarshalInputCreateDocumentInput, ec.unmarshalInputCreateDraftDocumentVersionInput, ec.unmarshalInputCreateEvidenceInput, @@ -4265,9 +4522,11 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputCreateTaskInput, ec.unmarshalInputCreateVendorInput, ec.unmarshalInputCreateVendorRiskAssessmentInput, + ec.unmarshalInputDatumOrder, ec.unmarshalInputDeleteAssetInput, ec.unmarshalInputDeleteControlDocumentMappingInput, ec.unmarshalInputDeleteControlMeasureMappingInput, + ec.unmarshalInputDeleteDatumInput, ec.unmarshalInputDeleteDocumentInput, ec.unmarshalInputDeleteEvidenceInput, ec.unmarshalInputDeleteFrameworkInput, @@ -4296,6 +4555,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputPeopleOrder, ec.unmarshalInputPublishDocumentVersionInput, ec.unmarshalInputRemoveAssetVendorInput, + ec.unmarshalInputRemoveDatumVendorInput, ec.unmarshalInputRemoveUserInput, ec.unmarshalInputRequestEvidenceInput, ec.unmarshalInputRequestSignatureInput, @@ -4304,6 +4564,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ec.unmarshalInputTaskOrder, ec.unmarshalInputUnassignTaskInput, ec.unmarshalInputUpdateAssetInput, + ec.unmarshalInputUpdateDatumInput, ec.unmarshalInputUpdateDocumentInput, ec.unmarshalInputUpdateDocumentVersionInput, ec.unmarshalInputUpdateFrameworkInput, @@ -4664,10 +4925,10 @@ enum VendorComplianceReportOrderField ) } -enum OrganizationOrderField { - NAME - CREATED_AT - UPDATED_AT +enum OrganizationOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderField") { + NAME @goEnum(value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldName") + CREATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldCreatedAt") + UPDATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.OrganizationOrderFieldUpdatedAt") } enum ConnectorOrderField @@ -4779,6 +5040,12 @@ enum AssetOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.Ass CRITICITY @goEnum(value: "github.com/getprobo/probo/pkg/coredata.AssetOrderFieldCriticity") } +enum DatumOrderField @goModel(model: "github.com/getprobo/probo/pkg/coredata.DatumOrderField") { + CREATED_AT @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldCreatedAt") + NAME @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldName") + DATA_SENSITIVITY @goEnum(value: "github.com/getprobo/probo/pkg/coredata.DatumOrderFieldDataSensitivity") +} + # Order Input Types input UserOrder @goModel( @@ -4976,6 +5243,14 @@ type Organization implements Node { orderBy: AssetOrder ): AssetConnection! @goField(forceResolver: true) + data( + first: Int + after: CursorKey + last: Int + before: CursorKey + orderBy: DatumOrder + ): DatumConnection! @goField(forceResolver: true) + createdAt: Datetime! updatedAt: Datetime! } @@ -5442,6 +5717,16 @@ type DocumentVersionEdge { node: DocumentVersion! } +type DatumConnection { + edges: [DatumEdge!]! + pageInfo: PageInfo! +} + +type DatumEdge { + cursor: CursorKey! + node: Datum! +} + # Root Types type Query { node(id: ID!): Node! @@ -5576,6 +5861,12 @@ type Mutation { deleteAsset(input: DeleteAssetInput!): DeleteAssetPayload! addAssetVendor(input: AddAssetVendorInput!): AddAssetVendorPayload! removeAssetVendor(input: RemoveAssetVendorInput!): RemoveAssetVendorPayload! + + createDatum(input: CreateDatumInput!): CreateDatumPayload! + updateDatum(input: UpdateDatumInput!): UpdateDatumPayload! + deleteDatum(input: DeleteDatumInput!): DeleteDatumPayload! + addDatumVendor(input: AddDatumVendorInput!): AddDatumVendorPayload! + removeDatumVendor(input: RemoveDatumVendorInput!): RemoveDatumVendorPayload! } # Input Types @@ -6373,6 +6664,78 @@ type AddAssetVendorPayload { type RemoveAssetVendorPayload { asset: Asset! } + +type Datum implements Node { + id: ID! + name: String! + dataSensitivity: DataSensitivity! + owner: People! @goField(forceResolver: true) + vendors( + first: Int + after: CursorKey + last: Int + before: CursorKey + orderBy: VendorOrder + ): VendorConnection! @goField(forceResolver: true) + organization: Organization! @goField(forceResolver: true) + createdAt: Datetime! + updatedAt: Datetime! +} + +input DatumOrder { + direction: OrderDirection! + field: DatumOrderField! +} + +input CreateDatumInput { + organizationId: ID! + name: String! + dataSensitivity: DataSensitivity! + ownerId: ID! + vendorIds: [ID!] +} + +input UpdateDatumInput { + id: ID! + name: String + dataSensitivity: DataSensitivity + ownerId: ID + vendorIds: [ID!] +} + +input DeleteDatumInput { + datumId: ID! +} + +input AddDatumVendorInput { + datumId: ID! + vendorId: ID! +} + +input RemoveDatumVendorInput { + datumId: ID! + vendorId: ID! +} + +type CreateDatumPayload { + datumEdge: DatumEdge! +} + +type UpdateDatumPayload { + datum: Datum! +} + +type DeleteDatumPayload { + deletedDatumId: ID! +} + +type AddDatumVendorPayload { + datum: Datum! +} + +type RemoveDatumVendorPayload { + datum: Datum! +} `, BuiltIn: false}, } var parsedSchema = gqlparser.MustLoadSchema(sources...) @@ -6666,6 +7029,101 @@ func (ec *executionContext) field_Control_measures_argsOrderBy( return zeroVal, nil } +func (ec *executionContext) field_Datum_vendors_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Datum_vendors_argsFirst(ctx, rawArgs) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := ec.field_Datum_vendors_argsAfter(ctx, rawArgs) + if err != nil { + return nil, err + } + args["after"] = arg1 + arg2, err := ec.field_Datum_vendors_argsLast(ctx, rawArgs) + if err != nil { + return nil, err + } + args["last"] = arg2 + arg3, err := ec.field_Datum_vendors_argsBefore(ctx, rawArgs) + if err != nil { + return nil, err + } + args["before"] = arg3 + arg4, err := ec.field_Datum_vendors_argsOrderBy(ctx, rawArgs) + if err != nil { + return nil, err + } + args["orderBy"] = arg4 + return args, nil +} +func (ec *executionContext) field_Datum_vendors_argsFirst( + ctx context.Context, + rawArgs map[string]any, +) (*int, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("first")) + if tmp, ok := rawArgs["first"]; ok { + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } + + var zeroVal *int + return zeroVal, nil +} + +func (ec *executionContext) field_Datum_vendors_argsAfter( + ctx context.Context, + rawArgs map[string]any, +) (*page.CursorKey, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("after")) + if tmp, ok := rawArgs["after"]; ok { + return ec.unmarshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, tmp) + } + + var zeroVal *page.CursorKey + return zeroVal, nil +} + +func (ec *executionContext) field_Datum_vendors_argsLast( + ctx context.Context, + rawArgs map[string]any, +) (*int, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("last")) + if tmp, ok := rawArgs["last"]; ok { + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } + + var zeroVal *int + return zeroVal, nil +} + +func (ec *executionContext) field_Datum_vendors_argsBefore( + ctx context.Context, + rawArgs map[string]any, +) (*page.CursorKey, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("before")) + if tmp, ok := rawArgs["before"]; ok { + return ec.unmarshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, tmp) + } + + var zeroVal *page.CursorKey + return zeroVal, nil +} + +func (ec *executionContext) field_Datum_vendors_argsOrderBy( + ctx context.Context, + rawArgs map[string]any, +) (*types.VendorOrderBy, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("orderBy")) + if tmp, ok := rawArgs["orderBy"]; ok { + return ec.unmarshalOVendorOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐVendorOrderBy(ctx, tmp) + } + + var zeroVal *types.VendorOrderBy + return zeroVal, nil +} + func (ec *executionContext) field_DocumentVersion_signatures_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -7467,6 +7925,29 @@ func (ec *executionContext) field_Mutation_addAssetVendor_argsInput( return zeroVal, nil } +func (ec *executionContext) field_Mutation_addDatumVendor_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_addDatumVendor_argsInput(ctx, rawArgs) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} +func (ec *executionContext) field_Mutation_addDatumVendor_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (types.AddDatumVendorInput, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNAddDatumVendorInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐAddDatumVendorInput(ctx, tmp) + } + + var zeroVal types.AddDatumVendorInput + return zeroVal, nil +} + func (ec *executionContext) field_Mutation_assessVendor_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -7605,6 +8086,29 @@ func (ec *executionContext) field_Mutation_createControlMeasureMapping_argsInput return zeroVal, nil } +func (ec *executionContext) field_Mutation_createDatum_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_createDatum_argsInput(ctx, rawArgs) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} +func (ec *executionContext) field_Mutation_createDatum_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (types.CreateDatumInput, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNCreateDatumInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateDatumInput(ctx, tmp) + } + + var zeroVal types.CreateDatumInput + return zeroVal, nil +} + func (ec *executionContext) field_Mutation_createDocument_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -7950,6 +8454,29 @@ func (ec *executionContext) field_Mutation_deleteControlMeasureMapping_argsInput return zeroVal, nil } +func (ec *executionContext) field_Mutation_deleteDatum_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_deleteDatum_argsInput(ctx, rawArgs) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} +func (ec *executionContext) field_Mutation_deleteDatum_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (types.DeleteDatumInput, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNDeleteDatumInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteDatumInput(ctx, tmp) + } + + var zeroVal types.DeleteDatumInput + return zeroVal, nil +} + func (ec *executionContext) field_Mutation_deleteDocument_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -8387,6 +8914,29 @@ func (ec *executionContext) field_Mutation_removeAssetVendor_argsInput( return zeroVal, nil } +func (ec *executionContext) field_Mutation_removeDatumVendor_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_removeDatumVendor_argsInput(ctx, rawArgs) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} +func (ec *executionContext) field_Mutation_removeDatumVendor_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (types.RemoveDatumVendorInput, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNRemoveDatumVendorInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRemoveDatumVendorInput(ctx, tmp) + } + + var zeroVal types.RemoveDatumVendorInput + return zeroVal, nil +} + func (ec *executionContext) field_Mutation_removeUser_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -8525,6 +9075,29 @@ func (ec *executionContext) field_Mutation_updateAsset_argsInput( return zeroVal, nil } +func (ec *executionContext) field_Mutation_updateDatum_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Mutation_updateDatum_argsInput(ctx, rawArgs) + if err != nil { + return nil, err + } + args["input"] = arg0 + return args, nil +} +func (ec *executionContext) field_Mutation_updateDatum_argsInput( + ctx context.Context, + rawArgs map[string]any, +) (types.UpdateDatumInput, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("input")) + if tmp, ok := rawArgs["input"]; ok { + return ec.unmarshalNUpdateDatumInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateDatumInput(ctx, tmp) + } + + var zeroVal types.UpdateDatumInput + return zeroVal, nil +} + func (ec *executionContext) field_Mutation_updateDocumentVersion_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -8991,6 +9564,101 @@ func (ec *executionContext) field_Organization_connectors_argsOrderBy( return zeroVal, nil } +func (ec *executionContext) field_Organization_data_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := ec.field_Organization_data_argsFirst(ctx, rawArgs) + if err != nil { + return nil, err + } + args["first"] = arg0 + arg1, err := ec.field_Organization_data_argsAfter(ctx, rawArgs) + if err != nil { + return nil, err + } + args["after"] = arg1 + arg2, err := ec.field_Organization_data_argsLast(ctx, rawArgs) + if err != nil { + return nil, err + } + args["last"] = arg2 + arg3, err := ec.field_Organization_data_argsBefore(ctx, rawArgs) + if err != nil { + return nil, err + } + args["before"] = arg3 + arg4, err := ec.field_Organization_data_argsOrderBy(ctx, rawArgs) + if err != nil { + return nil, err + } + args["orderBy"] = arg4 + return args, nil +} +func (ec *executionContext) field_Organization_data_argsFirst( + ctx context.Context, + rawArgs map[string]any, +) (*int, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("first")) + if tmp, ok := rawArgs["first"]; ok { + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } + + var zeroVal *int + return zeroVal, nil +} + +func (ec *executionContext) field_Organization_data_argsAfter( + ctx context.Context, + rawArgs map[string]any, +) (*page.CursorKey, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("after")) + if tmp, ok := rawArgs["after"]; ok { + return ec.unmarshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, tmp) + } + + var zeroVal *page.CursorKey + return zeroVal, nil +} + +func (ec *executionContext) field_Organization_data_argsLast( + ctx context.Context, + rawArgs map[string]any, +) (*int, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("last")) + if tmp, ok := rawArgs["last"]; ok { + return ec.unmarshalOInt2ᚖint(ctx, tmp) + } + + var zeroVal *int + return zeroVal, nil +} + +func (ec *executionContext) field_Organization_data_argsBefore( + ctx context.Context, + rawArgs map[string]any, +) (*page.CursorKey, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("before")) + if tmp, ok := rawArgs["before"]; ok { + return ec.unmarshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, tmp) + } + + var zeroVal *page.CursorKey + return zeroVal, nil +} + +func (ec *executionContext) field_Organization_data_argsOrderBy( + ctx context.Context, + rawArgs map[string]any, +) (*types.DatumOrder, error) { + ctx = graphql.WithPathContext(ctx, graphql.NewPathWithField("orderBy")) + if tmp, ok := rawArgs["orderBy"]; ok { + return ec.unmarshalODatumOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatumOrder(ctx, tmp) + } + + var zeroVal *types.DatumOrder + return zeroVal, nil +} + func (ec *executionContext) field_Organization_documents_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -10653,6 +11321,68 @@ func (ec *executionContext) fieldContext_AddAssetVendorPayload_asset(_ context.C return fc, nil } +func (ec *executionContext) _AddDatumVendorPayload_datum(ctx context.Context, field graphql.CollectedField, obj *types.AddDatumVendorPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_AddDatumVendorPayload_datum(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Datum, 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.Datum) + fc.Result = res + return ec.marshalNDatum2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatum(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_AddDatumVendorPayload_datum(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "AddDatumVendorPayload", + 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_Datum_id(ctx, field) + case "name": + return ec.fieldContext_Datum_name(ctx, field) + case "dataSensitivity": + return ec.fieldContext_Datum_dataSensitivity(ctx, field) + case "owner": + return ec.fieldContext_Datum_owner(ctx, field) + case "vendors": + return ec.fieldContext_Datum_vendors(ctx, field) + case "organization": + return ec.fieldContext_Datum_organization(ctx, field) + case "createdAt": + return ec.fieldContext_Datum_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Datum_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Datum", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _AssessVendorPayload_vendor(ctx context.Context, field graphql.CollectedField, obj *types.AssessVendorPayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_AssessVendorPayload_vendor(ctx, field) if err != nil { @@ -11203,6 +11933,8 @@ func (ec *executionContext) fieldContext_Asset_organization(_ context.Context, f return ec.fieldContext_Organization_tasks(ctx, field) case "assets": return ec.fieldContext_Organization_assets(ctx, field) + case "data": + return ec.fieldContext_Organization_data(ctx, field) case "createdAt": return ec.fieldContext_Organization_createdAt(ctx, field) case "updatedAt": @@ -12962,6 +13694,56 @@ func (ec *executionContext) fieldContext_CreateControlMeasureMappingPayload_meas return fc, nil } +func (ec *executionContext) _CreateDatumPayload_datumEdge(ctx context.Context, field graphql.CollectedField, obj *types.CreateDatumPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_CreateDatumPayload_datumEdge(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.DatumEdge, 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.DatumEdge) + fc.Result = res + return ec.marshalNDatumEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatumEdge(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_CreateDatumPayload_datumEdge(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "CreateDatumPayload", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "cursor": + return ec.fieldContext_DatumEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_DatumEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DatumEdge", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _CreateDocumentPayload_documentEdge(ctx context.Context, field graphql.CollectedField, obj *types.CreateDocumentPayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_CreateDocumentPayload_documentEdge(ctx, field) if err != nil { @@ -13762,6 +14544,641 @@ func (ec *executionContext) fieldContext_CreateVendorRiskAssessmentPayload_vendo return fc, nil } +func (ec *executionContext) _Datum_id(ctx context.Context, field graphql.CollectedField, obj *types.Datum) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Datum_id(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + 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_Datum_id(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Datum", + 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) _Datum_name(ctx context.Context, field graphql.CollectedField, obj *types.Datum) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Datum_name(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Name, 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.(string) + fc.Result = res + return ec.marshalNString2string(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Datum_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Datum", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type String does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Datum_dataSensitivity(ctx context.Context, field graphql.CollectedField, obj *types.Datum) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Datum_dataSensitivity(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.DataSensitivity, 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.(coredata.DataSensitivity) + fc.Result = res + return ec.marshalNDataSensitivity2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Datum_dataSensitivity(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Datum", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type DataSensitivity does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Datum_owner(ctx context.Context, field graphql.CollectedField, obj *types.Datum) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Datum_owner(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Datum().Owner(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.People) + fc.Result = res + return ec.marshalNPeople2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPeople(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Datum_owner(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Datum", + 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_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 "position": + return ec.fieldContext_People_position(ctx, field) + case "contractStartDate": + return ec.fieldContext_People_contractStartDate(ctx, field) + case "contractEndDate": + return ec.fieldContext_People_contractEndDate(ctx, field) + case "createdAt": + return ec.fieldContext_People_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_People_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type People", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _Datum_vendors(ctx context.Context, field graphql.CollectedField, obj *types.Datum) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Datum_vendors(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Datum().Vendors(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey), fc.Args["orderBy"].(*types.VendorOrderBy)) + }) + 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.VendorConnection) + fc.Result = res + return ec.marshalNVendorConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐVendorConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Datum_vendors(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Datum", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_VendorConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_VendorConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type VendorConnection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Datum_vendors_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Datum_organization(ctx context.Context, field graphql.CollectedField, obj *types.Datum) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Datum_organization(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Datum().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ᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐOrganization(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Datum_organization(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Datum", + 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 "users": + return ec.fieldContext_Organization_users(ctx, field) + case "connectors": + return ec.fieldContext_Organization_connectors(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 "documents": + return ec.fieldContext_Organization_documents(ctx, field) + case "measures": + return ec.fieldContext_Organization_measures(ctx, field) + case "risks": + return ec.fieldContext_Organization_risks(ctx, field) + case "tasks": + return ec.fieldContext_Organization_tasks(ctx, field) + case "assets": + return ec.fieldContext_Organization_assets(ctx, field) + case "data": + return ec.fieldContext_Organization_data(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) _Datum_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.Datum) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Datum_createdAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.CreatedAt, 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.(time.Time) + fc.Result = res + return ec.marshalNDatetime2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Datum_createdAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Datum", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Datetime does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _Datum_updatedAt(ctx context.Context, field graphql.CollectedField, obj *types.Datum) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Datum_updatedAt(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.UpdatedAt, 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.(time.Time) + fc.Result = res + return ec.marshalNDatetime2timeᚐTime(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Datum_updatedAt(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Datum", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type Datetime does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DatumConnection_edges(ctx context.Context, field graphql.CollectedField, obj *types.DatumConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DatumConnection_edges(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Edges, 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.DatumEdge) + fc.Result = res + return ec.marshalNDatumEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatumEdgeᚄ(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DatumConnection_edges(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DatumConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "cursor": + return ec.fieldContext_DatumEdge_cursor(ctx, field) + case "node": + return ec.fieldContext_DatumEdge_node(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DatumEdge", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DatumConnection_pageInfo(ctx context.Context, field graphql.CollectedField, obj *types.DatumConnection) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DatumConnection_pageInfo(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.PageInfo, 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.PageInfo) + fc.Result = res + return ec.marshalNPageInfo2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐPageInfo(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DatumConnection_pageInfo(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DatumConnection", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "hasNextPage": + return ec.fieldContext_PageInfo_hasNextPage(ctx, field) + case "hasPreviousPage": + return ec.fieldContext_PageInfo_hasPreviousPage(ctx, field) + case "startCursor": + return ec.fieldContext_PageInfo_startCursor(ctx, field) + case "endCursor": + return ec.fieldContext_PageInfo_endCursor(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PageInfo", field.Name) + }, + } + return fc, nil +} + +func (ec *executionContext) _DatumEdge_cursor(ctx context.Context, field graphql.CollectedField, obj *types.DatumEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DatumEdge_cursor(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Cursor, 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.(page.CursorKey) + fc.Result = res + return ec.marshalNCursorKey2githubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐCursorKey(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DatumEdge_cursor(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DatumEdge", + Field: field, + IsMethod: false, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + return nil, errors.New("field of type CursorKey does not have child fields") + }, + } + return fc, nil +} + +func (ec *executionContext) _DatumEdge_node(ctx context.Context, field graphql.CollectedField, obj *types.DatumEdge) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DatumEdge_node(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Node, 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.Datum) + fc.Result = res + return ec.marshalNDatum2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatum(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_DatumEdge_node(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DatumEdge", + 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_Datum_id(ctx, field) + case "name": + return ec.fieldContext_Datum_name(ctx, field) + case "dataSensitivity": + return ec.fieldContext_Datum_dataSensitivity(ctx, field) + case "owner": + return ec.fieldContext_Datum_owner(ctx, field) + case "vendors": + return ec.fieldContext_Datum_vendors(ctx, field) + case "organization": + return ec.fieldContext_Datum_organization(ctx, field) + case "createdAt": + return ec.fieldContext_Datum_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Datum_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Datum", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _DeleteAssetPayload_deletedAssetId(ctx context.Context, field graphql.CollectedField, obj *types.DeleteAssetPayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_DeleteAssetPayload_deletedAssetId(ctx, field) if err != nil { @@ -13982,6 +15399,50 @@ func (ec *executionContext) fieldContext_DeleteControlMeasureMappingPayload_dele return fc, nil } +func (ec *executionContext) _DeleteDatumPayload_deletedDatumId(ctx context.Context, field graphql.CollectedField, obj *types.DeleteDatumPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_DeleteDatumPayload_deletedDatumId(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.DeletedDatumID, 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_DeleteDatumPayload_deletedDatumId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "DeleteDatumPayload", + 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) _DeleteDocumentPayload_deletedDocumentId(ctx context.Context, field graphql.CollectedField, obj *types.DeleteDocumentPayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_DeleteDocumentPayload_deletedDocumentId(ctx, field) if err != nil { @@ -14946,6 +16407,8 @@ func (ec *executionContext) fieldContext_Document_organization(_ context.Context return ec.fieldContext_Organization_tasks(ctx, field) case "assets": return ec.fieldContext_Organization_assets(ctx, field) + case "data": + return ec.fieldContext_Organization_data(ctx, field) case "createdAt": return ec.fieldContext_Organization_createdAt(ctx, field) case "updatedAt": @@ -17885,6 +19348,8 @@ func (ec *executionContext) fieldContext_Framework_organization(_ context.Contex return ec.fieldContext_Organization_tasks(ctx, field) case "assets": return ec.fieldContext_Organization_assets(ctx, field) + case "data": + return ec.fieldContext_Organization_data(ctx, field) case "createdAt": return ec.fieldContext_Organization_createdAt(ctx, field) case "updatedAt": @@ -22716,6 +24181,301 @@ func (ec *executionContext) fieldContext_Mutation_removeAssetVendor(ctx context. return fc, nil } +func (ec *executionContext) _Mutation_createDatum(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_createDatum(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().CreateDatum(rctx, fc.Args["input"].(types.CreateDatumInput)) + }) + 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.CreateDatumPayload) + fc.Result = res + return ec.marshalNCreateDatumPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateDatumPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_createDatum(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "datumEdge": + return ec.fieldContext_CreateDatumPayload_datumEdge(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CreateDatumPayload", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_createDatum_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_updateDatum(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_updateDatum(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().UpdateDatum(rctx, fc.Args["input"].(types.UpdateDatumInput)) + }) + 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.UpdateDatumPayload) + fc.Result = res + return ec.marshalNUpdateDatumPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateDatumPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_updateDatum(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "datum": + return ec.fieldContext_UpdateDatumPayload_datum(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type UpdateDatumPayload", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_updateDatum_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_deleteDatum(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_deleteDatum(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().DeleteDatum(rctx, fc.Args["input"].(types.DeleteDatumInput)) + }) + 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.DeleteDatumPayload) + fc.Result = res + return ec.marshalNDeleteDatumPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteDatumPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_deleteDatum(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "deletedDatumId": + return ec.fieldContext_DeleteDatumPayload_deletedDatumId(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DeleteDatumPayload", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_deleteDatum_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_addDatumVendor(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_addDatumVendor(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().AddDatumVendor(rctx, fc.Args["input"].(types.AddDatumVendorInput)) + }) + 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.AddDatumVendorPayload) + fc.Result = res + return ec.marshalNAddDatumVendorPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐAddDatumVendorPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_addDatumVendor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "datum": + return ec.fieldContext_AddDatumVendorPayload_datum(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type AddDatumVendorPayload", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_addDatumVendor_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + +func (ec *executionContext) _Mutation_removeDatumVendor(ctx context.Context, field graphql.CollectedField) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Mutation_removeDatumVendor(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Mutation().RemoveDatumVendor(rctx, fc.Args["input"].(types.RemoveDatumVendorInput)) + }) + 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.RemoveDatumVendorPayload) + fc.Result = res + return ec.marshalNRemoveDatumVendorPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRemoveDatumVendorPayload(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Mutation_removeDatumVendor(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Mutation", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "datum": + return ec.fieldContext_RemoveDatumVendorPayload_datum(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type RemoveDatumVendorPayload", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Mutation_removeDatumVendor_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Organization_id(ctx context.Context, field graphql.CollectedField, obj *types.Organization) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Organization_id(ctx, field) if err != nil { @@ -23455,6 +25215,67 @@ func (ec *executionContext) fieldContext_Organization_assets(ctx context.Context return fc, nil } +func (ec *executionContext) _Organization_data(ctx context.Context, field graphql.CollectedField, obj *types.Organization) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_Organization_data(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return ec.resolvers.Organization().Data(rctx, obj, fc.Args["first"].(*int), fc.Args["after"].(*page.CursorKey), fc.Args["last"].(*int), fc.Args["before"].(*page.CursorKey), fc.Args["orderBy"].(*types.DatumOrder)) + }) + 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.DatumConnection) + fc.Result = res + return ec.marshalNDatumConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatumConnection(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_Organization_data(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "Organization", + Field: field, + IsMethod: true, + IsResolver: true, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_DatumConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_DatumConnection_pageInfo(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type DatumConnection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_Organization_data_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _Organization_createdAt(ctx context.Context, field graphql.CollectedField, obj *types.Organization) (ret graphql.Marshaler) { fc, err := ec.fieldContext_Organization_createdAt(ctx, field) if err != nil { @@ -23756,6 +25577,8 @@ func (ec *executionContext) fieldContext_OrganizationEdge_node(_ context.Context return ec.fieldContext_Organization_tasks(ctx, field) case "assets": return ec.fieldContext_Organization_assets(ctx, field) + case "data": + return ec.fieldContext_Organization_data(ctx, field) case "createdAt": return ec.fieldContext_Organization_createdAt(ctx, field) case "updatedAt": @@ -25024,6 +26847,68 @@ func (ec *executionContext) fieldContext_RemoveAssetVendorPayload_asset(_ contex return fc, nil } +func (ec *executionContext) _RemoveDatumVendorPayload_datum(ctx context.Context, field graphql.CollectedField, obj *types.RemoveDatumVendorPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_RemoveDatumVendorPayload_datum(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Datum, 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.Datum) + fc.Result = res + return ec.marshalNDatum2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatum(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_RemoveDatumVendorPayload_datum(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "RemoveDatumVendorPayload", + 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_Datum_id(ctx, field) + case "name": + return ec.fieldContext_Datum_name(ctx, field) + case "dataSensitivity": + return ec.fieldContext_Datum_dataSensitivity(ctx, field) + case "owner": + return ec.fieldContext_Datum_owner(ctx, field) + case "vendors": + return ec.fieldContext_Datum_vendors(ctx, field) + case "organization": + return ec.fieldContext_Datum_organization(ctx, field) + case "createdAt": + return ec.fieldContext_Datum_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Datum_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Datum", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _RemoveUserPayload_success(ctx context.Context, field graphql.CollectedField, obj *types.RemoveUserPayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_RemoveUserPayload_success(ctx, field) if err != nil { @@ -25824,6 +27709,8 @@ func (ec *executionContext) fieldContext_Risk_organization(_ context.Context, fi return ec.fieldContext_Organization_tasks(ctx, field) case "assets": return ec.fieldContext_Organization_assets(ctx, field) + case "data": + return ec.fieldContext_Organization_data(ctx, field) case "createdAt": return ec.fieldContext_Organization_createdAt(ctx, field) case "updatedAt": @@ -26815,6 +28702,8 @@ func (ec *executionContext) fieldContext_Task_organization(_ context.Context, fi return ec.fieldContext_Organization_tasks(ctx, field) case "assets": return ec.fieldContext_Organization_assets(ctx, field) + case "data": + return ec.fieldContext_Organization_data(ctx, field) case "createdAt": return ec.fieldContext_Organization_createdAt(ctx, field) case "updatedAt": @@ -27392,6 +29281,68 @@ func (ec *executionContext) fieldContext_UpdateAssetPayload_asset(_ context.Cont return fc, nil } +func (ec *executionContext) _UpdateDatumPayload_datum(ctx context.Context, field graphql.CollectedField, obj *types.UpdateDatumPayload) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_UpdateDatumPayload_datum(ctx, field) + if err != nil { + return graphql.Null + } + ctx = graphql.WithFieldContext(ctx, fc) + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = graphql.Null + } + }() + resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) { + ctx = rctx // use context from middleware stack in children + return obj.Datum, 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.Datum) + fc.Result = res + return ec.marshalNDatum2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatum(ctx, field.Selections, res) +} + +func (ec *executionContext) fieldContext_UpdateDatumPayload_datum(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "UpdateDatumPayload", + 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_Datum_id(ctx, field) + case "name": + return ec.fieldContext_Datum_name(ctx, field) + case "dataSensitivity": + return ec.fieldContext_Datum_dataSensitivity(ctx, field) + case "owner": + return ec.fieldContext_Datum_owner(ctx, field) + case "vendors": + return ec.fieldContext_Datum_vendors(ctx, field) + case "organization": + return ec.fieldContext_Datum_organization(ctx, field) + case "createdAt": + return ec.fieldContext_Datum_createdAt(ctx, field) + case "updatedAt": + return ec.fieldContext_Datum_updatedAt(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type Datum", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _UpdateDocumentPayload_document(ctx context.Context, field graphql.CollectedField, obj *types.UpdateDocumentPayload) (ret graphql.Marshaler) { fc, err := ec.fieldContext_UpdateDocumentPayload_document(ctx, field) if err != nil { @@ -27721,6 +29672,8 @@ func (ec *executionContext) fieldContext_UpdateOrganizationPayload_organization( return ec.fieldContext_Organization_tasks(ctx, field) case "assets": return ec.fieldContext_Organization_assets(ctx, field) + case "data": + return ec.fieldContext_Organization_data(ctx, field) case "createdAt": return ec.fieldContext_Organization_createdAt(ctx, field) case "updatedAt": @@ -28932,6 +30885,8 @@ func (ec *executionContext) fieldContext_Vendor_organization(_ context.Context, return ec.fieldContext_Organization_tasks(ctx, field) case "assets": return ec.fieldContext_Organization_assets(ctx, field) + case "data": + return ec.fieldContext_Organization_data(ctx, field) case "createdAt": return ec.fieldContext_Organization_createdAt(ctx, field) case "updatedAt": @@ -33583,6 +35538,40 @@ func (ec *executionContext) unmarshalInputAddAssetVendorInput(ctx context.Contex return it, nil } +func (ec *executionContext) unmarshalInputAddDatumVendorInput(ctx context.Context, obj any) (types.AddDatumVendorInput, error) { + var it types.AddDatumVendorInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"datumId", "vendorId"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "datumId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("datumId")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.DatumID = data + case "vendorId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("vendorId")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.VendorID = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputAssessVendorInput(ctx context.Context, obj any) (types.AssessVendorInput, error) { var it types.AssessVendorInput asMap := map[string]any{} @@ -33928,6 +35917,61 @@ func (ec *executionContext) unmarshalInputCreateControlMeasureMappingInput(ctx c return it, nil } +func (ec *executionContext) unmarshalInputCreateDatumInput(ctx context.Context, obj any) (types.CreateDatumInput, error) { + var it types.CreateDatumInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"organizationId", "name", "dataSensitivity", "ownerId", "vendorIds"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "organizationId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("organizationId")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.OrganizationID = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalNString2string(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "dataSensitivity": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dataSensitivity")) + data, err := ec.unmarshalNDataSensitivity2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity(ctx, v) + if err != nil { + return it, err + } + it.DataSensitivity = data + case "ownerId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerId")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.OwnerID = data + case "vendorIds": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("vendorIds")) + data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGIDᚄ(ctx, v) + if err != nil { + return it, err + } + it.VendorIds = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputCreateDocumentInput(ctx context.Context, obj any) (types.CreateDocumentInput, error) { var it types.CreateDocumentInput asMap := map[string]any{} @@ -34706,6 +36750,40 @@ func (ec *executionContext) unmarshalInputCreateVendorRiskAssessmentInput(ctx co return it, nil } +func (ec *executionContext) unmarshalInputDatumOrder(ctx context.Context, obj any) (types.DatumOrder, error) { + var it types.DatumOrder + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"direction", "field"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "direction": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("direction")) + data, err := ec.unmarshalNOrderDirection2githubᚗcomᚋgetproboᚋproboᚋpkgᚋpageᚐOrderDirection(ctx, v) + if err != nil { + return it, err + } + it.Direction = data + case "field": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) + data, err := ec.unmarshalNDatumOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDatumOrderField(ctx, v) + if err != nil { + return it, err + } + it.Field = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputDeleteAssetInput(ctx context.Context, obj any) (types.DeleteAssetInput, error) { var it types.DeleteAssetInput asMap := map[string]any{} @@ -34801,6 +36879,33 @@ func (ec *executionContext) unmarshalInputDeleteControlMeasureMappingInput(ctx c return it, nil } +func (ec *executionContext) unmarshalInputDeleteDatumInput(ctx context.Context, obj any) (types.DeleteDatumInput, error) { + var it types.DeleteDatumInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"datumId"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "datumId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("datumId")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.DatumID = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputDeleteDocumentInput(ctx context.Context, obj any) (types.DeleteDocumentInput, error) { var it types.DeleteDocumentInput asMap := map[string]any{} @@ -35577,7 +37682,7 @@ func (ec *executionContext) unmarshalInputOrganizationOrder(ctx context.Context, it.Direction = data case "field": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("field")) - data, err := ec.unmarshalNOrganizationOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐOrganizationOrderField(ctx, v) + data, err := ec.unmarshalNOrganizationOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐOrganizationOrderField(ctx, v) if err != nil { return it, err } @@ -35683,6 +37788,40 @@ func (ec *executionContext) unmarshalInputRemoveAssetVendorInput(ctx context.Con return it, nil } +func (ec *executionContext) unmarshalInputRemoveDatumVendorInput(ctx context.Context, obj any) (types.RemoveDatumVendorInput, error) { + var it types.RemoveDatumVendorInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"datumId", "vendorId"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "datumId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("datumId")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.DatumID = data + case "vendorId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("vendorId")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.VendorID = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputRemoveUserInput(ctx context.Context, obj any) (types.RemoveUserInput, error) { var it types.RemoveUserInput asMap := map[string]any{} @@ -35997,6 +38136,61 @@ func (ec *executionContext) unmarshalInputUpdateAssetInput(ctx context.Context, return it, nil } +func (ec *executionContext) unmarshalInputUpdateDatumInput(ctx context.Context, obj any) (types.UpdateDatumInput, error) { + var it types.UpdateDatumInput + asMap := map[string]any{} + for k, v := range obj.(map[string]any) { + asMap[k] = v + } + + fieldsInOrder := [...]string{"id", "name", "dataSensitivity", "ownerId", "vendorIds"} + for _, k := range fieldsInOrder { + v, ok := asMap[k] + if !ok { + continue + } + switch k { + case "id": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("id")) + data, err := ec.unmarshalNID2githubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.ID = data + case "name": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("name")) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) + if err != nil { + return it, err + } + it.Name = data + case "dataSensitivity": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("dataSensitivity")) + data, err := ec.unmarshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity(ctx, v) + if err != nil { + return it, err + } + it.DataSensitivity = data + case "ownerId": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("ownerId")) + data, err := ec.unmarshalOID2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGID(ctx, v) + if err != nil { + return it, err + } + it.OwnerID = data + case "vendorIds": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("vendorIds")) + data, err := ec.unmarshalOID2ᚕgithubᚗcomᚋgetproboᚋproboᚋpkgᚋgidᚐGIDᚄ(ctx, v) + if err != nil { + return it, err + } + it.VendorIds = data + } + } + + return it, nil +} + func (ec *executionContext) unmarshalInputUpdateDocumentInput(ctx context.Context, obj any) (types.UpdateDocumentInput, error) { var it types.UpdateDocumentInput asMap := map[string]any{} @@ -36976,6 +39170,13 @@ func (ec *executionContext) _Node(ctx context.Context, sel ast.SelectionSet, obj return graphql.Null } return ec._Document(ctx, sel, obj) + case types.Datum: + return ec._Datum(ctx, sel, &obj) + case *types.Datum: + if obj == nil { + return graphql.Null + } + return ec._Datum(ctx, sel, obj) case types.Control: return ec._Control(ctx, sel, &obj) case *types.Control: @@ -37045,6 +39246,45 @@ func (ec *executionContext) _AddAssetVendorPayload(ctx context.Context, sel ast. return out } +var addDatumVendorPayloadImplementors = []string{"AddDatumVendorPayload"} + +func (ec *executionContext) _AddDatumVendorPayload(ctx context.Context, sel ast.SelectionSet, obj *types.AddDatumVendorPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, addDatumVendorPayloadImplementors) + + 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("AddDatumVendorPayload") + case "datum": + out.Values[i] = ec._AddDatumVendorPayload_datum(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 assessVendorPayloadImplementors = []string{"AssessVendorPayload"} func (ec *executionContext) _AssessVendorPayload(ctx context.Context, sel ast.SelectionSet, obj *types.AssessVendorPayload) graphql.Marshaler { @@ -37997,6 +40237,45 @@ func (ec *executionContext) _CreateControlMeasureMappingPayload(ctx context.Cont return out } +var createDatumPayloadImplementors = []string{"CreateDatumPayload"} + +func (ec *executionContext) _CreateDatumPayload(ctx context.Context, sel ast.SelectionSet, obj *types.CreateDatumPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, createDatumPayloadImplementors) + + 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("CreateDatumPayload") + case "datumEdge": + out.Values[i] = ec._CreateDatumPayload_datumEdge(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 createDocumentPayloadImplementors = []string{"CreateDocumentPayload"} func (ec *executionContext) _CreateDocumentPayload(ctx context.Context, sel ast.SelectionSet, obj *types.CreateDocumentPayload) graphql.Marshaler { @@ -38519,6 +40798,261 @@ func (ec *executionContext) _CreateVendorRiskAssessmentPayload(ctx context.Conte return out } +var datumImplementors = []string{"Datum", "Node"} + +func (ec *executionContext) _Datum(ctx context.Context, sel ast.SelectionSet, obj *types.Datum) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, datumImplementors) + + 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("Datum") + case "id": + out.Values[i] = ec._Datum_id(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "name": + out.Values[i] = ec._Datum_name(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "dataSensitivity": + out.Values[i] = ec._Datum_dataSensitivity(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "owner": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Datum_owner(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) }) + case "vendors": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Datum_vendors(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) }) + case "organization": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Datum_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) }) + case "createdAt": + out.Values[i] = ec._Datum_createdAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + case "updatedAt": + out.Values[i] = ec._Datum_updatedAt(ctx, field, obj) + if out.Values[i] == graphql.Null { + atomic.AddUint32(&out.Invalids, 1) + } + 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 datumConnectionImplementors = []string{"DatumConnection"} + +func (ec *executionContext) _DatumConnection(ctx context.Context, sel ast.SelectionSet, obj *types.DatumConnection) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, datumConnectionImplementors) + + 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("DatumConnection") + case "edges": + out.Values[i] = ec._DatumConnection_edges(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "pageInfo": + out.Values[i] = ec._DatumConnection_pageInfo(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 datumEdgeImplementors = []string{"DatumEdge"} + +func (ec *executionContext) _DatumEdge(ctx context.Context, sel ast.SelectionSet, obj *types.DatumEdge) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, datumEdgeImplementors) + + 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("DatumEdge") + case "cursor": + out.Values[i] = ec._DatumEdge_cursor(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "node": + out.Values[i] = ec._DatumEdge_node(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 deleteAssetPayloadImplementors = []string{"DeleteAssetPayload"} func (ec *executionContext) _DeleteAssetPayload(ctx context.Context, sel ast.SelectionSet, obj *types.DeleteAssetPayload) graphql.Marshaler { @@ -38646,6 +41180,45 @@ func (ec *executionContext) _DeleteControlMeasureMappingPayload(ctx context.Cont return out } +var deleteDatumPayloadImplementors = []string{"DeleteDatumPayload"} + +func (ec *executionContext) _DeleteDatumPayload(ctx context.Context, sel ast.SelectionSet, obj *types.DeleteDatumPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, deleteDatumPayloadImplementors) + + 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("DeleteDatumPayload") + case "deletedDatumId": + out.Values[i] = ec._DeleteDatumPayload_deletedDatumId(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 deleteDocumentPayloadImplementors = []string{"DeleteDocumentPayload"} func (ec *executionContext) _DeleteDocumentPayload(ctx context.Context, sel ast.SelectionSet, obj *types.DeleteDocumentPayload) graphql.Marshaler { @@ -41361,6 +43934,41 @@ func (ec *executionContext) _Mutation(ctx context.Context, sel ast.SelectionSet) if out.Values[i] == graphql.Null { out.Invalids++ } + case "createDatum": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_createDatum(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "updateDatum": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_updateDatum(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "deleteDatum": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_deleteDatum(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "addDatumVendor": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_addDatumVendor(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "removeDatumVendor": + out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) { + return ec._Mutation_removeDatumVendor(ctx, field) + }) + if out.Values[i] == graphql.Null { + out.Invalids++ + } default: panic("unknown field " + strconv.Quote(field.Name)) } @@ -41797,6 +44405,42 @@ func (ec *executionContext) _Organization(ctx context.Context, sel ast.Selection continue } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "data": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._Organization_data(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) }) case "createdAt": out.Values[i] = ec._Organization_createdAt(ctx, field, obj) @@ -42307,6 +44951,45 @@ func (ec *executionContext) _RemoveAssetVendorPayload(ctx context.Context, sel a return out } +var removeDatumVendorPayloadImplementors = []string{"RemoveDatumVendorPayload"} + +func (ec *executionContext) _RemoveDatumVendorPayload(ctx context.Context, sel ast.SelectionSet, obj *types.RemoveDatumVendorPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, removeDatumVendorPayloadImplementors) + + 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("RemoveDatumVendorPayload") + case "datum": + out.Values[i] = ec._RemoveDatumVendorPayload_datum(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 removeUserPayloadImplementors = []string{"RemoveUserPayload"} func (ec *executionContext) _RemoveUserPayload(ctx context.Context, sel ast.SelectionSet, obj *types.RemoveUserPayload) graphql.Marshaler { @@ -43246,6 +45929,45 @@ func (ec *executionContext) _UpdateAssetPayload(ctx context.Context, sel ast.Sel return out } +var updateDatumPayloadImplementors = []string{"UpdateDatumPayload"} + +func (ec *executionContext) _UpdateDatumPayload(ctx context.Context, sel ast.SelectionSet, obj *types.UpdateDatumPayload) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, updateDatumPayloadImplementors) + + 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("UpdateDatumPayload") + case "datum": + out.Values[i] = ec._UpdateDatumPayload_datum(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 updateDocumentPayloadImplementors = []string{"UpdateDocumentPayload"} func (ec *executionContext) _UpdateDocumentPayload(ctx context.Context, sel ast.SelectionSet, obj *types.UpdateDocumentPayload) graphql.Marshaler { @@ -45137,6 +47859,25 @@ func (ec *executionContext) marshalNAddAssetVendorPayload2ᚖgithubᚗcomᚋgetp return ec._AddAssetVendorPayload(ctx, sel, v) } +func (ec *executionContext) unmarshalNAddDatumVendorInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐAddDatumVendorInput(ctx context.Context, v any) (types.AddDatumVendorInput, error) { + res, err := ec.unmarshalInputAddDatumVendorInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNAddDatumVendorPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐAddDatumVendorPayload(ctx context.Context, sel ast.SelectionSet, v types.AddDatumVendorPayload) graphql.Marshaler { + return ec._AddDatumVendorPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNAddDatumVendorPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐAddDatumVendorPayload(ctx context.Context, sel ast.SelectionSet, v *types.AddDatumVendorPayload) 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._AddDatumVendorPayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNAssessVendorInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐAssessVendorInput(ctx context.Context, v any) (types.AssessVendorInput, error) { res, err := ec.unmarshalInputAssessVendorInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -45645,6 +48386,25 @@ func (ec *executionContext) marshalNCreateControlMeasureMappingPayload2ᚖgithub return ec._CreateControlMeasureMappingPayload(ctx, sel, v) } +func (ec *executionContext) unmarshalNCreateDatumInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateDatumInput(ctx context.Context, v any) (types.CreateDatumInput, error) { + res, err := ec.unmarshalInputCreateDatumInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNCreateDatumPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateDatumPayload(ctx context.Context, sel ast.SelectionSet, v types.CreateDatumPayload) graphql.Marshaler { + return ec._CreateDatumPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNCreateDatumPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateDatumPayload(ctx context.Context, sel ast.SelectionSet, v *types.CreateDatumPayload) 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._CreateDatumPayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNCreateDocumentInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐCreateDocumentInput(ctx context.Context, v any) (types.CreateDocumentInput, error) { res, err := ec.unmarshalInputCreateDocumentInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -45969,6 +48729,114 @@ func (ec *executionContext) marshalNDatetime2timeᚐTime(ctx context.Context, se return res } +func (ec *executionContext) marshalNDatum2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatum(ctx context.Context, sel ast.SelectionSet, v *types.Datum) 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._Datum(ctx, sel, v) +} + +func (ec *executionContext) marshalNDatumConnection2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatumConnection(ctx context.Context, sel ast.SelectionSet, v types.DatumConnection) graphql.Marshaler { + return ec._DatumConnection(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDatumConnection2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatumConnection(ctx context.Context, sel ast.SelectionSet, v *types.DatumConnection) 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._DatumConnection(ctx, sel, v) +} + +func (ec *executionContext) marshalNDatumEdge2ᚕᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatumEdgeᚄ(ctx context.Context, sel ast.SelectionSet, v []*types.DatumEdge) graphql.Marshaler { + ret := make(graphql.Array, len(v)) + var wg sync.WaitGroup + isLen1 := len(v) == 1 + if !isLen1 { + wg.Add(len(v)) + } + for i := range v { + i := i + fc := &graphql.FieldContext{ + Index: &i, + Result: &v[i], + } + ctx := graphql.WithFieldContext(ctx, fc) + f := func(i int) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + ret = nil + } + }() + if !isLen1 { + defer wg.Done() + } + ret[i] = ec.marshalNDatumEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatumEdge(ctx, sel, v[i]) + } + if isLen1 { + f(i) + } else { + go f(i) + } + + } + wg.Wait() + + for _, e := range ret { + if e == graphql.Null { + return graphql.Null + } + } + + return ret +} + +func (ec *executionContext) marshalNDatumEdge2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatumEdge(ctx context.Context, sel ast.SelectionSet, v *types.DatumEdge) 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._DatumEdge(ctx, sel, v) +} + +func (ec *executionContext) unmarshalNDatumOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDatumOrderField(ctx context.Context, v any) (coredata.DatumOrderField, error) { + tmp, err := graphql.UnmarshalString(v) + res := unmarshalNDatumOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDatumOrderField[tmp] + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNDatumOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDatumOrderField(ctx context.Context, sel ast.SelectionSet, v coredata.DatumOrderField) graphql.Marshaler { + _ = sel + res := graphql.MarshalString(marshalNDatumOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDatumOrderField[v]) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res +} + +var ( + unmarshalNDatumOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDatumOrderField = map[string]coredata.DatumOrderField{ + "CREATED_AT": coredata.DatumOrderFieldCreatedAt, + "NAME": coredata.DatumOrderFieldName, + "DATA_SENSITIVITY": coredata.DatumOrderFieldDataSensitivity, + } + marshalNDatumOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDatumOrderField = map[coredata.DatumOrderField]string{ + coredata.DatumOrderFieldCreatedAt: "CREATED_AT", + coredata.DatumOrderFieldName: "NAME", + coredata.DatumOrderFieldDataSensitivity: "DATA_SENSITIVITY", + } +) + func (ec *executionContext) unmarshalNDeleteAssetInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteAssetInput(ctx context.Context, v any) (types.DeleteAssetInput, error) { res, err := ec.unmarshalInputDeleteAssetInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -46026,6 +48894,25 @@ func (ec *executionContext) marshalNDeleteControlMeasureMappingPayload2ᚖgithub return ec._DeleteControlMeasureMappingPayload(ctx, sel, v) } +func (ec *executionContext) unmarshalNDeleteDatumInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteDatumInput(ctx context.Context, v any) (types.DeleteDatumInput, error) { + res, err := ec.unmarshalInputDeleteDatumInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNDeleteDatumPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteDatumPayload(ctx context.Context, sel ast.SelectionSet, v types.DeleteDatumPayload) graphql.Marshaler { + return ec._DeleteDatumPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNDeleteDatumPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteDatumPayload(ctx context.Context, sel ast.SelectionSet, v *types.DeleteDatumPayload) 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._DeleteDatumPayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNDeleteDocumentInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDeleteDocumentInput(ctx context.Context, v any) (types.DeleteDocumentInput, error) { res, err := ec.unmarshalInputDeleteDocumentInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -47312,16 +50199,36 @@ func (ec *executionContext) marshalNOrganizationEdge2ᚖgithubᚗcomᚋgetprobo return ec._OrganizationEdge(ctx, sel, v) } -func (ec *executionContext) unmarshalNOrganizationOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐOrganizationOrderField(ctx context.Context, v any) (types.OrganizationOrderField, error) { - var res types.OrganizationOrderField - err := res.UnmarshalGQL(v) +func (ec *executionContext) unmarshalNOrganizationOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐOrganizationOrderField(ctx context.Context, v any) (coredata.OrganizationOrderField, error) { + tmp, err := graphql.UnmarshalString(v) + res := unmarshalNOrganizationOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐOrganizationOrderField[tmp] return res, graphql.ErrorOnPath(ctx, err) } -func (ec *executionContext) marshalNOrganizationOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐOrganizationOrderField(ctx context.Context, sel ast.SelectionSet, v types.OrganizationOrderField) graphql.Marshaler { - return v +func (ec *executionContext) marshalNOrganizationOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐOrganizationOrderField(ctx context.Context, sel ast.SelectionSet, v coredata.OrganizationOrderField) graphql.Marshaler { + _ = sel + res := graphql.MarshalString(marshalNOrganizationOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐOrganizationOrderField[v]) + if res == graphql.Null { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + } + return res } +var ( + unmarshalNOrganizationOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐOrganizationOrderField = map[string]coredata.OrganizationOrderField{ + "NAME": coredata.OrganizationOrderFieldName, + "CREATED_AT": coredata.OrganizationOrderFieldCreatedAt, + "UPDATED_AT": coredata.OrganizationOrderFieldUpdatedAt, + } + marshalNOrganizationOrderField2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐOrganizationOrderField = map[coredata.OrganizationOrderField]string{ + coredata.OrganizationOrderFieldName: "NAME", + coredata.OrganizationOrderFieldCreatedAt: "CREATED_AT", + coredata.OrganizationOrderFieldUpdatedAt: "UPDATED_AT", + } +) + func (ec *executionContext) marshalNPageInfo2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋ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)) { @@ -47510,6 +50417,25 @@ func (ec *executionContext) marshalNRemoveAssetVendorPayload2ᚖgithubᚗcomᚋg return ec._RemoveAssetVendorPayload(ctx, sel, v) } +func (ec *executionContext) unmarshalNRemoveDatumVendorInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRemoveDatumVendorInput(ctx context.Context, v any) (types.RemoveDatumVendorInput, error) { + res, err := ec.unmarshalInputRemoveDatumVendorInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNRemoveDatumVendorPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRemoveDatumVendorPayload(ctx context.Context, sel ast.SelectionSet, v types.RemoveDatumVendorPayload) graphql.Marshaler { + return ec._RemoveDatumVendorPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNRemoveDatumVendorPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRemoveDatumVendorPayload(ctx context.Context, sel ast.SelectionSet, v *types.RemoveDatumVendorPayload) 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._RemoveDatumVendorPayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNRemoveUserInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐRemoveUserInput(ctx context.Context, v any) (types.RemoveUserInput, error) { res, err := ec.unmarshalInputRemoveUserInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -47941,6 +50867,25 @@ func (ec *executionContext) marshalNUpdateAssetPayload2ᚖgithubᚗcomᚋgetprob return ec._UpdateAssetPayload(ctx, sel, v) } +func (ec *executionContext) unmarshalNUpdateDatumInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateDatumInput(ctx context.Context, v any) (types.UpdateDatumInput, error) { + res, err := ec.unmarshalInputUpdateDatumInput(ctx, v) + return res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalNUpdateDatumPayload2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateDatumPayload(ctx context.Context, sel ast.SelectionSet, v types.UpdateDatumPayload) graphql.Marshaler { + return ec._UpdateDatumPayload(ctx, sel, &v) +} + +func (ec *executionContext) marshalNUpdateDatumPayload2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateDatumPayload(ctx context.Context, sel ast.SelectionSet, v *types.UpdateDatumPayload) 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._UpdateDatumPayload(ctx, sel, v) +} + func (ec *executionContext) unmarshalNUpdateDocumentInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUpdateDocumentInput(ctx context.Context, v any) (types.UpdateDocumentInput, error) { res, err := ec.unmarshalInputUpdateDocumentInput(ctx, v) return res, graphql.ErrorOnPath(ctx, err) @@ -49071,6 +52016,42 @@ func (ec *executionContext) marshalOCursorKey2ᚖgithubᚗcomᚋgetproboᚋprobo return res } +func (ec *executionContext) unmarshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity(ctx context.Context, v any) (*coredata.DataSensitivity, error) { + if v == nil { + return nil, nil + } + tmp, err := graphql.UnmarshalString(v) + res := unmarshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity[tmp] + return &res, graphql.ErrorOnPath(ctx, err) +} + +func (ec *executionContext) marshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity(ctx context.Context, sel ast.SelectionSet, v *coredata.DataSensitivity) graphql.Marshaler { + if v == nil { + return graphql.Null + } + _ = sel + _ = ctx + res := graphql.MarshalString(marshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity[*v]) + return res +} + +var ( + unmarshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity = map[string]coredata.DataSensitivity{ + "NONE": coredata.DataSensitivityNone, + "LOW": coredata.DataSensitivityLow, + "MEDIUM": coredata.DataSensitivityMedium, + "HIGH": coredata.DataSensitivityHigh, + "CRITICAL": coredata.DataSensitivityCritical, + } + marshalODataSensitivity2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐDataSensitivity = map[coredata.DataSensitivity]string{ + coredata.DataSensitivityNone: "NONE", + coredata.DataSensitivityLow: "LOW", + coredata.DataSensitivityMedium: "MEDIUM", + coredata.DataSensitivityHigh: "HIGH", + coredata.DataSensitivityCritical: "CRITICAL", + } +) + func (ec *executionContext) unmarshalODatetime2ᚖtimeᚐTime(ctx context.Context, v any) (*time.Time, error) { if v == nil { return nil, nil @@ -49089,6 +52070,14 @@ func (ec *executionContext) marshalODatetime2ᚖtimeᚐTime(ctx context.Context, return res } +func (ec *executionContext) unmarshalODatumOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDatumOrder(ctx context.Context, v any) (*types.DatumOrder, error) { + if v == nil { + return nil, nil + } + res, err := ec.unmarshalInputDatumOrder(ctx, v) + return &res, graphql.ErrorOnPath(ctx, err) +} + func (ec *executionContext) unmarshalODocumentOrder2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐDocumentOrderBy(ctx context.Context, v any) (*types.DocumentOrderBy, error) { if v == nil { return nil, nil diff --git a/pkg/server/api/console/v1/types/data.go b/pkg/server/api/console/v1/types/data.go new file mode 100644 index 000000000..c2586c08d --- /dev/null +++ b/pkg/server/api/console/v1/types/data.go @@ -0,0 +1,36 @@ +package types + +import ( + "github.com/getprobo/probo/pkg/coredata" + "github.com/getprobo/probo/pkg/page" +) + +func NewDatum(d *coredata.Data) *Datum { + return &Datum{ + ID: d.ID, + Name: d.Name, + DataSensitivity: d.DataSensitivity, + CreatedAt: d.CreatedAt, + UpdatedAt: d.UpdatedAt, + Organization: &Organization{ID: d.OrganizationID}, + } +} + +func NewDatumEdge(d *coredata.Data, orderField coredata.DatumOrderField) *DatumEdge { + return &DatumEdge{ + Node: NewDatum(d), + Cursor: d.CursorKey(orderField), + } +} + +func NewDataConnection(page *page.Page[*coredata.Data, coredata.DatumOrderField]) *DatumConnection { + edges := make([]*DatumEdge, len(page.Data)) + for i, data := range page.Data { + edges[i] = NewDatumEdge(data, page.Cursor.OrderBy.Field) + } + + return &DatumConnection{ + Edges: edges, + PageInfo: NewPageInfo(page), + } +} diff --git a/pkg/server/api/console/v1/types/types.go b/pkg/server/api/console/v1/types/types.go index 72cc2a5c0..7e68f5988 100644 --- a/pkg/server/api/console/v1/types/types.go +++ b/pkg/server/api/console/v1/types/types.go @@ -3,10 +3,6 @@ package types import ( - "bytes" - "fmt" - "io" - "strconv" "time" "github.com/99designs/gqlgen/graphql" @@ -29,6 +25,15 @@ type AddAssetVendorPayload struct { Asset *Asset `json:"asset"` } +type AddDatumVendorInput struct { + DatumID gid.GID `json:"datumId"` + VendorID gid.GID `json:"vendorId"` +} + +type AddDatumVendorPayload struct { + Datum *Datum `json:"datum"` +} + type AssessVendorInput struct { ID gid.GID `json:"id"` WebsiteURL string `json:"websiteUrl"` @@ -173,6 +178,18 @@ type CreateControlMeasureMappingPayload struct { MeasureEdge *MeasureEdge `json:"measureEdge"` } +type CreateDatumInput struct { + OrganizationID gid.GID `json:"organizationId"` + Name string `json:"name"` + DataSensitivity coredata.DataSensitivity `json:"dataSensitivity"` + OwnerID gid.GID `json:"ownerId"` + VendorIds []gid.GID `json:"vendorIds,omitempty"` +} + +type CreateDatumPayload struct { + DatumEdge *DatumEdge `json:"datumEdge"` +} + type CreateDocumentInput struct { OrganizationID gid.GID `json:"organizationId"` Title string `json:"title"` @@ -341,6 +358,35 @@ type CreateVendorRiskAssessmentPayload struct { VendorRiskAssessmentEdge *VendorRiskAssessmentEdge `json:"vendorRiskAssessmentEdge"` } +type Datum struct { + ID gid.GID `json:"id"` + Name string `json:"name"` + DataSensitivity coredata.DataSensitivity `json:"dataSensitivity"` + Owner *People `json:"owner"` + Vendors *VendorConnection `json:"vendors"` + Organization *Organization `json:"organization"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` +} + +func (Datum) IsNode() {} +func (this Datum) GetID() gid.GID { return this.ID } + +type DatumConnection struct { + Edges []*DatumEdge `json:"edges"` + PageInfo *PageInfo `json:"pageInfo"` +} + +type DatumEdge struct { + Cursor page.CursorKey `json:"cursor"` + Node *Datum `json:"node"` +} + +type DatumOrder struct { + Direction page.OrderDirection `json:"direction"` + Field coredata.DatumOrderField `json:"field"` +} + type DeleteAssetInput struct { AssetID gid.GID `json:"assetId"` } @@ -369,6 +415,14 @@ type DeleteControlMeasureMappingPayload struct { DeletedMeasureID gid.GID `json:"deletedMeasureId"` } +type DeleteDatumInput struct { + DatumID gid.GID `json:"datumId"` +} + +type DeleteDatumPayload struct { + DeletedDatumID gid.GID `json:"deletedDatumId"` +} + type DeleteDocumentInput struct { DocumentID gid.GID `json:"documentId"` } @@ -700,6 +754,7 @@ type Organization struct { Risks *RiskConnection `json:"risks"` Tasks *TaskConnection `json:"tasks"` Assets *AssetConnection `json:"assets"` + Data *DatumConnection `json:"data"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` } @@ -718,8 +773,8 @@ type OrganizationEdge struct { } type OrganizationOrder struct { - Direction page.OrderDirection `json:"direction"` - Field OrganizationOrderField `json:"field"` + Direction page.OrderDirection `json:"direction"` + Field coredata.OrganizationOrderField `json:"field"` } type PageInfo struct { @@ -776,6 +831,15 @@ type RemoveAssetVendorPayload struct { Asset *Asset `json:"asset"` } +type RemoveDatumVendorInput struct { + DatumID gid.GID `json:"datumId"` + VendorID gid.GID `json:"vendorId"` +} + +type RemoveDatumVendorPayload struct { + Datum *Datum `json:"datum"` +} + type RemoveUserInput struct { OrganizationID gid.GID `json:"organizationId"` UserID gid.GID `json:"userId"` @@ -903,6 +967,18 @@ type UpdateAssetPayload struct { Asset *Asset `json:"asset"` } +type UpdateDatumInput struct { + ID gid.GID `json:"id"` + Name *string `json:"name,omitempty"` + DataSensitivity *coredata.DataSensitivity `json:"dataSensitivity,omitempty"` + OwnerID *gid.GID `json:"ownerId,omitempty"` + VendorIds []gid.GID `json:"vendorIds,omitempty"` +} + +type UpdateDatumPayload struct { + Datum *Datum `json:"datum"` +} + type UpdateDocumentInput struct { ID gid.GID `json:"id"` Title *string `json:"title,omitempty"` @@ -1181,60 +1257,3 @@ type Viewer struct { User *User `json:"user"` Organizations *OrganizationConnection `json:"organizations"` } - -type OrganizationOrderField string - -const ( - OrganizationOrderFieldName OrganizationOrderField = "NAME" - OrganizationOrderFieldCreatedAt OrganizationOrderField = "CREATED_AT" - OrganizationOrderFieldUpdatedAt OrganizationOrderField = "UPDATED_AT" -) - -var AllOrganizationOrderField = []OrganizationOrderField{ - OrganizationOrderFieldName, - OrganizationOrderFieldCreatedAt, - OrganizationOrderFieldUpdatedAt, -} - -func (e OrganizationOrderField) IsValid() bool { - switch e { - case OrganizationOrderFieldName, OrganizationOrderFieldCreatedAt, OrganizationOrderFieldUpdatedAt: - return true - } - return false -} - -func (e OrganizationOrderField) String() string { - return string(e) -} - -func (e *OrganizationOrderField) UnmarshalGQL(v any) error { - str, ok := v.(string) - if !ok { - return fmt.Errorf("enums must be strings") - } - - *e = OrganizationOrderField(str) - if !e.IsValid() { - return fmt.Errorf("%s is not a valid OrganizationOrderField", str) - } - return nil -} - -func (e OrganizationOrderField) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) -} - -func (e *OrganizationOrderField) UnmarshalJSON(b []byte) error { - s, err := strconv.Unquote(string(b)) - if err != nil { - return err - } - return e.UnmarshalGQL(s) -} - -func (e OrganizationOrderField) MarshalJSON() ([]byte, error) { - var buf bytes.Buffer - e.MarshalGQL(&buf) - return buf.Bytes(), nil -} diff --git a/pkg/server/api/console/v1/v1_resolver.go b/pkg/server/api/console/v1/v1_resolver.go index 286390063..025ffa1b7 100644 --- a/pkg/server/api/console/v1/v1_resolver.go +++ b/pkg/server/api/console/v1/v1_resolver.go @@ -146,6 +146,60 @@ func (r *controlResolver) Documents(ctx context.Context, obj *types.Control, fir return types.NewDocumentConnection(page), nil } +// Owner is the resolver for the owner field. +func (r *datumResolver) Owner(ctx context.Context, obj *types.Datum) (*types.People, error) { + svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID()) + + data, err := svc.Data.Get(ctx, obj.ID) + if err != nil { + return nil, fmt.Errorf("cannot get datum: %w", err) + } + + people, err := svc.Peoples.Get(ctx, data.OwnerID) + if err != nil { + return nil, fmt.Errorf("cannot get owner: %w", err) + } + + return types.NewPeople(people), nil +} + +// Vendors is the resolver for the vendors field. +func (r *datumResolver) Vendors(ctx context.Context, obj *types.Datum, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.VendorOrderBy) (*types.VendorConnection, error) { + svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID()) + + pageOrderBy := page.OrderBy[coredata.VendorOrderField]{ + Field: coredata.VendorOrderFieldCreatedAt, + Direction: page.OrderDirectionDesc, + } + if orderBy != nil { + pageOrderBy = page.OrderBy[coredata.VendorOrderField]{ + Field: orderBy.Field, + Direction: orderBy.Direction, + } + } + + cursor := types.NewCursor(first, after, last, before, pageOrderBy) + + page, err := svc.Data.ListVendors(ctx, obj.ID, cursor) + if err != nil { + panic(fmt.Errorf("cannot list data vendors: %w", err)) + } + + return types.NewVendorConnection(page), nil +} + +// Organization is the resolver for the organization field. +func (r *datumResolver) Organization(ctx context.Context, obj *types.Datum) (*types.Organization, error) { + svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID()) + + org, err := svc.Organizations.Get(ctx, obj.Organization.ID) + if err != nil { + return nil, fmt.Errorf("cannot get organization: %w", err) + } + + return types.NewOrganization(org), nil +} + // Owner is the resolver for the owner field. func (r *documentResolver) Owner(ctx context.Context, obj *types.Document) (*types.People, error) { svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID()) @@ -1687,6 +1741,71 @@ func (r *mutationResolver) RemoveAssetVendor(ctx context.Context, input types.Re panic(fmt.Errorf("not implemented: RemoveAssetVendor - removeAssetVendor")) } +// CreateDatum is the resolver for the createDatum field. +func (r *mutationResolver) CreateDatum(ctx context.Context, input types.CreateDatumInput) (*types.CreateDatumPayload, error) { + svc := GetTenantService(ctx, r.proboSvc, input.OrganizationID.TenantID()) + + data, err := svc.Data.Create(ctx, probo.CreateDatumRequest{ + OrganizationID: input.OrganizationID, + Name: input.Name, + DataSensitivity: input.DataSensitivity, + OwnerID: input.OwnerID, + VendorIDs: input.VendorIds, + }) + + if err != nil { + return nil, fmt.Errorf("cannot create datum: %w", err) + } + + return &types.CreateDatumPayload{ + DatumEdge: types.NewDatumEdge(data, coredata.DatumOrderFieldCreatedAt), + }, nil +} + +// UpdateDatum is the resolver for the updateDatum field. +func (r *mutationResolver) UpdateDatum(ctx context.Context, input types.UpdateDatumInput) (*types.UpdateDatumPayload, error) { + svc := GetTenantService(ctx, r.proboSvc, input.ID.TenantID()) + + datum, err := svc.Data.Update(ctx, probo.UpdateDatumRequest{ + ID: input.ID, + Name: input.Name, + DataSensitivity: input.DataSensitivity, + OwnerID: input.OwnerID, + VendorIDs: input.VendorIds, + }) + + if err != nil { + return nil, fmt.Errorf("cannot update datum: %w", err) + } + + return &types.UpdateDatumPayload{ + Datum: types.NewDatum(datum), + }, nil +} + +// DeleteDatum is the resolver for the deleteDatum field. +func (r *mutationResolver) DeleteDatum(ctx context.Context, input types.DeleteDatumInput) (*types.DeleteDatumPayload, error) { + svc := GetTenantService(ctx, r.proboSvc, input.DatumID.TenantID()) + + if err := svc.Data.Delete(ctx, input.DatumID); err != nil { + return nil, fmt.Errorf("cannot delete datum: %w", err) + } + + return &types.DeleteDatumPayload{ + DeletedDatumID: input.DatumID, + }, nil +} + +// AddDatumVendor is the resolver for the addDatumVendor field. +func (r *mutationResolver) AddDatumVendor(ctx context.Context, input types.AddDatumVendorInput) (*types.AddDatumVendorPayload, error) { + panic(fmt.Errorf("not implemented: AddDatumVendor - addDatumVendor")) +} + +// RemoveDatumVendor is the resolver for the removeDatumVendor field. +func (r *mutationResolver) RemoveDatumVendor(ctx context.Context, input types.RemoveDatumVendorInput) (*types.RemoveDatumVendorPayload, error) { + panic(fmt.Errorf("not implemented: RemoveDatumVendor - removeDatumVendor")) +} + // LogoURL is the resolver for the logoUrl field. func (r *organizationResolver) LogoURL(ctx context.Context, obj *types.Organization) (*string, error) { svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID()) @@ -1942,6 +2061,31 @@ func (r *organizationResolver) Assets(ctx context.Context, obj *types.Organizati return types.NewAssetConnection(page), nil } +// Assets is the resolver for the assets field. +func (r *organizationResolver) Data(ctx context.Context, obj *types.Organization, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DatumOrder) (*types.DatumConnection, error) { + svc := GetTenantService(ctx, r.proboSvc, obj.ID.TenantID()) + + pageOrderBy := page.OrderBy[coredata.DatumOrderField]{ + Field: coredata.DatumOrderFieldCreatedAt, + Direction: page.OrderDirectionDesc, + } + if orderBy != nil { + pageOrderBy = page.OrderBy[coredata.DatumOrderField]{ + Field: orderBy.Field, + Direction: orderBy.Direction, + } + } + + cursor := types.NewCursor(first, after, last, before, pageOrderBy) + + page, err := svc.Data.ListForOrganizationID(ctx, obj.ID, cursor) + if err != nil { + panic(fmt.Errorf("cannot list organization data: %w", err)) + } + + return types.NewDataConnection(page), nil +} + // Node is the resolver for the node field. func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error) { svc := GetTenantService(ctx, r.proboSvc, id.TenantID()) @@ -2039,6 +2183,12 @@ func (r *queryResolver) Node(ctx context.Context, id gid.GID) (types.Node, error panic(fmt.Errorf("cannot get asset: %w", err)) } return types.NewAsset(asset), nil + case coredata.DatumEntityType: + datum, err := svc.Data.Get(ctx, id) + if err != nil { + panic(fmt.Errorf("cannot get data: %w", err)) + } + return types.NewDatum(datum), nil default: } @@ -2452,6 +2602,9 @@ func (r *Resolver) Asset() schema.AssetResolver { return &assetResolver{r} } // Control returns schema.ControlResolver implementation. func (r *Resolver) Control() schema.ControlResolver { return &controlResolver{r} } +// Datum returns schema.DatumResolver implementation. +func (r *Resolver) Datum() schema.DatumResolver { return &datumResolver{r} } + // Document returns schema.DocumentResolver implementation. func (r *Resolver) Document() schema.DocumentResolver { return &documentResolver{r} } @@ -2510,6 +2663,7 @@ func (r *Resolver) Viewer() schema.ViewerResolver { return &viewerResolver{r} } type assetResolver struct{ *Resolver } type controlResolver struct{ *Resolver } +type datumResolver struct{ *Resolver } type documentResolver struct{ *Resolver } type documentVersionResolver struct{ *Resolver } type documentVersionSignatureResolver struct{ *Resolver }