Add data inventory
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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() {
|
||||
<Route path="assets" element={<AssetsListPage />} />
|
||||
<Route path="assets/new" element={<NewAssetPage />} />
|
||||
<Route path="assets/:assetId" element={<AssetPage />} />
|
||||
<Route path="data" element={<DataListPage />} />
|
||||
<Route path="data/new" element={<NewDatumPage />} />
|
||||
<Route path="data/:datumId" element={<DatumPage />} />
|
||||
<Route path="settings" element={<SettingsPage />} />
|
||||
<Route path="*" element={<NotFoundPage />} />
|
||||
</Route>
|
||||
|
||||
52
apps/console/src/pages/organizations/data/DataListPage.tsx
Normal file
52
apps/console/src/pages/organizations/data/DataListPage.tsx
Normal file
@@ -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 (
|
||||
<PageTemplate
|
||||
title="Data"
|
||||
description="Keep track of your organization's data and their classification levels."
|
||||
>
|
||||
<div className="space-y-2">
|
||||
{Array.from({ length: 5 }).map((_, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className="flex items-center justify-between p-4 rounded-xl border bg-level-1"
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<Skeleton className="h-8 w-8 rounded-full" />
|
||||
<div className="space-y-1">
|
||||
<Skeleton className="h-4 w-48" />
|
||||
<Skeleton className="h-3 w-32" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Skeleton className="h-5 w-16" />
|
||||
<Skeleton className="h-5 w-16" />
|
||||
<Skeleton className="h-8 w-8" />
|
||||
<Skeleton className="h-4 w-4" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</PageTemplate>
|
||||
);
|
||||
}
|
||||
|
||||
export function DataListPage() {
|
||||
const location = useLocation();
|
||||
|
||||
return (
|
||||
<Suspense key={location.pathname} fallback={<DataListViewSkeleton />}>
|
||||
<ErrorBoundaryWithLocation>
|
||||
<DataListView />
|
||||
</ErrorBoundaryWithLocation>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
363
apps/console/src/pages/organizations/data/DataListView.tsx
Normal file
363
apps/console/src/pages/organizations/data/DataListView.tsx
Normal file
@@ -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 (
|
||||
<div className="flex justify-center">
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={onLoadMore}
|
||||
disabled={isLoading}
|
||||
className="w-full"
|
||||
>
|
||||
{isLoading ? "Loading..." : "Load above"}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function LoadBelowButton({
|
||||
isLoading,
|
||||
hasMore,
|
||||
onLoadMore,
|
||||
}: {
|
||||
isLoading: boolean;
|
||||
hasMore: boolean;
|
||||
onLoadMore: () => void;
|
||||
}) {
|
||||
if (!hasMore) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex justify-center">
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={onLoadMore}
|
||||
disabled={isLoading || !hasMore}
|
||||
className="w-full"
|
||||
>
|
||||
{isLoading ? "Loading..." : "Load below"}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DataListContent({
|
||||
queryRef,
|
||||
}: {
|
||||
queryRef: PreloadedQuery<DataListViewQueryType>;
|
||||
}) {
|
||||
const data = usePreloadedQuery<DataListViewQueryType>(
|
||||
dataListViewQuery,
|
||||
queryRef,
|
||||
);
|
||||
const [, setSearchParams] = useSearchParams();
|
||||
const [, startTransition] = useTransition();
|
||||
const [deleteData] =
|
||||
useMutation<DataListViewDeleteDataMutation>(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 (
|
||||
<>
|
||||
<PageTemplate
|
||||
title="Data"
|
||||
description="Keep track of your organization's data and their data sensitivity."
|
||||
actions={
|
||||
<Button asChild variant="secondary" className="gap-2">
|
||||
<Link to={`/organizations/${organizationId}/data/new`}>
|
||||
<Plus className="h-4 w-4" />
|
||||
Add data
|
||||
</Link>
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
<div className="space-y-6">
|
||||
<div className="space-y-2">
|
||||
{dataItems.map((item) => (
|
||||
<Link
|
||||
key={item?.id}
|
||||
to={`/organizations/${organizationId}/data/${item?.id}`}
|
||||
className="block"
|
||||
>
|
||||
<div className="flex items-center justify-between p-4 rounded-xl border bg-level-1 hover:bg-accent-bg/5 transition-colors">
|
||||
<div className="flex items-center gap-3">
|
||||
<Avatar className="h-8 w-8">
|
||||
<AvatarFallback>
|
||||
<Database className="h-4 w-4" />
|
||||
</AvatarFallback>
|
||||
</Avatar>
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex items-center gap-2">
|
||||
<p className="font-medium">{item?.name}</p>
|
||||
{item?.owner?.fullName && (
|
||||
<>
|
||||
<span className="text-tertiary">•</span>
|
||||
<p className="text-sm text-tertiary">
|
||||
Owned by {item.owner.fullName}
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{item?.vendors?.edges?.length > 0 && (
|
||||
<div className="text-sm text-tertiary">
|
||||
Vendors: {item.vendors.edges.map(edge => edge?.node?.name).join(", ")}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<Badge
|
||||
variant={
|
||||
item?.dataSensitivity === "NONE"
|
||||
? "default"
|
||||
: item?.dataSensitivity === "LOW"
|
||||
? "success"
|
||||
: item?.dataSensitivity === "MEDIUM"
|
||||
? "info"
|
||||
: item?.dataSensitivity === "HIGH"
|
||||
? "warning"
|
||||
: "destructive"
|
||||
}
|
||||
className="px-3 py-0.5 text-xs font-medium"
|
||||
>
|
||||
{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"}
|
||||
</Badge>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-8 w-8 text-tertiary hover:bg-transparent hover:[&>svg]:text-danger"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
if (
|
||||
window.confirm(
|
||||
"Are you sure you want to delete this data?",
|
||||
)
|
||||
) {
|
||||
deleteData({
|
||||
variables: {
|
||||
connections: [dataConnection.data.__id],
|
||||
input: {
|
||||
datumId: item.id,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
<Trash2 className="h-4 w-4 transition-colors" />
|
||||
</Button>
|
||||
<ChevronRight className="h-4 w-4 text-tertiary" />
|
||||
</div>
|
||||
</div>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<LoadAboveButton
|
||||
isLoading={isLoadingPrevious}
|
||||
hasMore={hasPrevious}
|
||||
onLoadMore={() => {
|
||||
startTransition(() => {
|
||||
isPaginationUpdate.current = true;
|
||||
setSearchParams((prev) => {
|
||||
prev.set("before", pageInfo?.startCursor || "");
|
||||
prev.delete("after");
|
||||
return prev;
|
||||
});
|
||||
loadPrevious(ITEMS_PER_PAGE);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
<LoadBelowButton
|
||||
isLoading={isLoadingNext}
|
||||
hasMore={hasNext}
|
||||
onLoadMore={() => {
|
||||
startTransition(() => {
|
||||
isPaginationUpdate.current = true;
|
||||
setSearchParams((prev) => {
|
||||
prev.set("after", pageInfo?.endCursor || "");
|
||||
prev.delete("before");
|
||||
return prev;
|
||||
});
|
||||
loadNext(ITEMS_PER_PAGE);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</PageTemplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default function DataListView() {
|
||||
const [searchParams] = useSearchParams();
|
||||
const [queryRef, loadQuery] =
|
||||
useQueryLoader<DataListViewQueryType>(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 <DataListViewSkeleton />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Suspense fallback={<DataListViewSkeleton />}>
|
||||
<DataListContent queryRef={queryRef} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
40
apps/console/src/pages/organizations/data/DatumPage.tsx
Normal file
40
apps/console/src/pages/organizations/data/DatumPage.tsx
Normal file
@@ -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 (
|
||||
<PageTemplateSkeleton>
|
||||
<div className="space-y-6">
|
||||
<div className="space-y-1">
|
||||
<div className="h-8 w-48 bg-subtle-bg animate-pulse rounded" />
|
||||
<div className="h-4 w-96 bg-subtle-bg animate-pulse rounded" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
{[1, 2].map((i) => (
|
||||
<div
|
||||
key={i}
|
||||
className="h-20 bg-subtle-bg animate-pulse rounded-lg"
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</PageTemplateSkeleton>
|
||||
);
|
||||
}
|
||||
|
||||
export function DatumPage() {
|
||||
const location = useLocation();
|
||||
|
||||
return (
|
||||
<Suspense key={location.pathname} fallback={<DatumViewSkeleton />}>
|
||||
<ErrorBoundaryWithLocation>
|
||||
<DatumView />
|
||||
</ErrorBoundaryWithLocation>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
372
apps/console/src/pages/organizations/data/DatumView.tsx
Normal file
372
apps/console/src/pages/organizations/data/DatumView.tsx
Normal file
@@ -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 (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-sm">{label}</Label>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Input
|
||||
type={type}
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
/>
|
||||
{helpText && <p className="text-sm text-secondary">{helpText}</p>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function DatumViewContent({
|
||||
queryRef,
|
||||
}: {
|
||||
queryRef: PreloadedQuery<DatumViewQueryType>;
|
||||
}) {
|
||||
const data = usePreloadedQuery(datumViewQuery, queryRef);
|
||||
const [editedFields, setEditedFields] = useState<Set<string>>(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 (
|
||||
<PageTemplate title={formData.name || "Data Details"}>
|
||||
<div className="space-y-6">
|
||||
<div className="max-w-4xl space-y-6">
|
||||
<EditableField
|
||||
label="Name"
|
||||
value={formData.name}
|
||||
onChange={(value) => handleFieldChange("name", value)}
|
||||
/>
|
||||
|
||||
<Card className="p-6">
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<h2 className="text-lg font-medium">Data Details</h2>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-sm">Owner</Label>
|
||||
</div>
|
||||
<PeopleSelector
|
||||
organizationRef={data.organization}
|
||||
selectedPersonId={formData.ownerId}
|
||||
onSelect={(value) => handleFieldChange("ownerId", value)}
|
||||
placeholder="Select data owner"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="text-sm">Vendors</Label>
|
||||
<Select
|
||||
value=""
|
||||
onValueChange={handleVendorSelect}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select vendors" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{vendors.map((vendor) => (
|
||||
<SelectItem key={vendor.id} value={vendor.id}>
|
||||
{vendor.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div className="flex flex-wrap gap-2 mt-2">
|
||||
{formData.selectedVendorIds.map((vendorId) => {
|
||||
const vendor = vendors.find((v) => v.id === vendorId);
|
||||
if (!vendor) return null;
|
||||
return (
|
||||
<Badge key={vendorId} variant="secondary" className="flex items-center gap-1">
|
||||
{vendor.name}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleVendorSelect(vendorId)}
|
||||
className="hover:bg-secondary-hover rounded-full p-0.5"
|
||||
>
|
||||
<X className="h-3 w-3" />
|
||||
</button>
|
||||
</Badge>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-sm">Data Sensitivity</Label>
|
||||
</div>
|
||||
<Select
|
||||
value={formData.dataSensitivity}
|
||||
onValueChange={(value) => handleFieldChange("dataSensitivity", value)}
|
||||
>
|
||||
<SelectTrigger className="w-full">
|
||||
<SelectValue placeholder="Select data sensitivity" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="NONE">No sensitive data</SelectItem>
|
||||
<SelectItem value="LOW">Public or non-sensitive data</SelectItem>
|
||||
<SelectItem value="MEDIUM">Internal/restricted data</SelectItem>
|
||||
<SelectItem value="HIGH">Confidential data</SelectItem>
|
||||
<SelectItem value="CRITICAL">Regulated/PII/financial data</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<div className="mt-6 flex justify-end gap-2">
|
||||
<Button variant="outline" onClick={handleCancel}>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
className="bg-primary text-invert hover:bg-primary/90"
|
||||
disabled={!hasChanges}
|
||||
>
|
||||
Save Changes
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</PageTemplate>
|
||||
);
|
||||
}
|
||||
|
||||
export default function DatumView() {
|
||||
const { datumId, organizationId } = useParams();
|
||||
const [queryRef, loadQuery] =
|
||||
useQueryLoader<DatumViewQueryType>(datumViewQuery);
|
||||
|
||||
useEffect(() => {
|
||||
loadQuery({ datumId: datumId!, organizationId: organizationId! });
|
||||
}, [loadQuery, datumId, organizationId]);
|
||||
|
||||
if (!queryRef || !datumId || !organizationId) {
|
||||
return <DatumViewSkeleton />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Suspense fallback={<DatumViewSkeleton />}>
|
||||
<DatumViewContent queryRef={queryRef} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
41
apps/console/src/pages/organizations/data/NewDatumPage.tsx
Normal file
41
apps/console/src/pages/organizations/data/NewDatumPage.tsx
Normal file
@@ -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 (
|
||||
<PageTemplate
|
||||
title="New Data"
|
||||
description="Add new data to your organization."
|
||||
>
|
||||
<div className="space-y-6 max-w-2xl">
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-8 w-64" />
|
||||
<Skeleton className="h-20 w-full" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-8 w-48" />
|
||||
<Skeleton className="h-10 w-full" />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-8 w-48" />
|
||||
<Skeleton className="h-10 w-full" />
|
||||
</div>
|
||||
<Skeleton className="h-10 w-32" />
|
||||
</div>
|
||||
</PageTemplate>
|
||||
);
|
||||
}
|
||||
export function NewDatumPage() {
|
||||
return (
|
||||
<Suspense fallback={<NewDatumViewSkeleton />}>
|
||||
<ErrorBoundaryWithLocation>
|
||||
<NewDatumView />
|
||||
</ErrorBoundaryWithLocation>
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
319
apps/console/src/pages/organizations/data/NewDatumView.tsx
Normal file
319
apps/console/src/pages/organizations/data/NewDatumView.tsx
Normal file
@@ -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 (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Label className="text-sm">{label}</Label>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<Input
|
||||
type={type}
|
||||
value={value}
|
||||
onChange={(e) => onChange(e.target.value)}
|
||||
required={required}
|
||||
/>
|
||||
{helpText && <p className="text-sm text-secondary">{helpText}</p>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function NewDataViewContent({
|
||||
queryRef,
|
||||
}: {
|
||||
queryRef: PreloadedQuery<NewDatumViewQuery>;
|
||||
}) {
|
||||
const navigate = useNavigate();
|
||||
const { organizationId } = useParams();
|
||||
const [createData] = useMutation<NewDatumViewCreateDatumMutation>(createDatumMutation);
|
||||
const { toast } = useToast();
|
||||
const data = usePreloadedQuery(newDatumViewQuery, queryRef);
|
||||
|
||||
if (!data.organization) {
|
||||
return <div>Organization not found</div>;
|
||||
}
|
||||
|
||||
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 = <K extends keyof FormData>(
|
||||
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 (
|
||||
<PageTemplate
|
||||
title="Create Data"
|
||||
description="Add new data to your organization"
|
||||
>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<div className="max-w-2xl space-y-6">
|
||||
<EditableField
|
||||
label="Name"
|
||||
value={formData.name}
|
||||
onChange={(value) => handleFieldChange("name", value)}
|
||||
required
|
||||
/>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="text-sm">Owner</Label>
|
||||
<PeopleSelector
|
||||
organizationRef={data.organization}
|
||||
selectedPersonId={formData.ownerId}
|
||||
onSelect={(value) => handleFieldChange("ownerId", value)}
|
||||
placeholder="Select data owner"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="text-sm">Vendors</Label>
|
||||
<Select
|
||||
value=""
|
||||
onValueChange={handleVendorSelect}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select vendors" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{vendors.map((vendor) => (
|
||||
<SelectItem key={vendor.id} value={vendor.id}>
|
||||
{vendor.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<div className="flex flex-wrap gap-2 mt-2">
|
||||
{formData.selectedVendorIds.map((vendorId) => {
|
||||
const vendor = vendors.find((v) => v.id === vendorId);
|
||||
if (!vendor) return null;
|
||||
return (
|
||||
<Badge key={vendorId} variant="secondary" className="flex items-center gap-1">
|
||||
{vendor.name}
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => handleVendorSelect(vendorId)}
|
||||
className="hover:bg-secondary-hover rounded-full p-0.5"
|
||||
>
|
||||
<X className="h-3 w-3" />
|
||||
</button>
|
||||
</Badge>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="text-sm">Data Sensitivity</Label>
|
||||
<Select
|
||||
value={formData.dataSensitivity}
|
||||
onValueChange={(value: string) =>
|
||||
handleFieldChange("dataSensitivity", value as "NONE" | "LOW" | "MEDIUM" | "HIGH" | "CRITICAL")}
|
||||
>
|
||||
<SelectTrigger>
|
||||
<SelectValue placeholder="Select data sensitivity" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="NONE">No sensitive data</SelectItem>
|
||||
<SelectItem value="LOW">Public or non-sensitive data</SelectItem>
|
||||
<SelectItem value="MEDIUM">Internal/restricted data</SelectItem>
|
||||
<SelectItem value="HIGH">Confidential data</SelectItem>
|
||||
<SelectItem value="CRITICAL">Regulated/PII/financial data</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<Button type="submit">Create Data</Button>
|
||||
</div>
|
||||
</form>
|
||||
</PageTemplate>
|
||||
);
|
||||
}
|
||||
|
||||
export default function NewDatumView() {
|
||||
const { organizationId } = useParams();
|
||||
const [queryRef, loadQuery] = useQueryLoader<NewDatumViewQuery>(newDatumViewQuery);
|
||||
|
||||
useEffect(() => {
|
||||
loadQuery({ organizationId: organizationId! });
|
||||
}, [loadQuery, organizationId]);
|
||||
|
||||
if (!queryRef) {
|
||||
return <NewDatumViewSkeleton />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Suspense fallback={<NewDatumViewSkeleton />}>
|
||||
<NewDataViewContent queryRef={queryRef} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
132
apps/console/src/pages/organizations/data/__generated__/DataListViewDeleteDataMutation.graphql.ts
generated
Normal file
132
apps/console/src/pages/organizations/data/__generated__/DataListViewDeleteDataMutation.graphql.ts
generated
Normal file
@@ -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<string>;
|
||||
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;
|
||||
383
apps/console/src/pages/organizations/data/__generated__/DataListViewPaginationQuery.graphql.ts
generated
Normal file
383
apps/console/src/pages/organizations/data/__generated__/DataListViewPaginationQuery.graphql.ts
generated
Normal file
@@ -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;
|
||||
383
apps/console/src/pages/organizations/data/__generated__/DataListViewQuery.graphql.ts
generated
Normal file
383
apps/console/src/pages/organizations/data/__generated__/DataListViewQuery.graphql.ts
generated
Normal file
@@ -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;
|
||||
321
apps/console/src/pages/organizations/data/__generated__/DataListView_data.graphql.ts
generated
Normal file
321
apps/console/src/pages/organizations/data/__generated__/DataListView_data.graphql.ts
generated
Normal file
@@ -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;
|
||||
496
apps/console/src/pages/organizations/data/__generated__/DatumViewQuery.graphql.ts
generated
Normal file
496
apps/console/src/pages/organizations/data/__generated__/DatumViewQuery.graphql.ts
generated
Normal file
@@ -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;
|
||||
199
apps/console/src/pages/organizations/data/__generated__/DatumViewUpdateDatumMutation.graphql.ts
generated
Normal file
199
apps/console/src/pages/organizations/data/__generated__/DatumViewUpdateDatumMutation.graphql.ts
generated
Normal file
@@ -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<string> | 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;
|
||||
341
apps/console/src/pages/organizations/data/__generated__/NewDataViewQuery.graphql.ts
generated
Normal file
341
apps/console/src/pages/organizations/data/__generated__/NewDataViewQuery.graphql.ts
generated
Normal file
@@ -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;
|
||||
247
apps/console/src/pages/organizations/data/__generated__/NewDatumViewCreateDatumMutation.graphql.ts
generated
Normal file
247
apps/console/src/pages/organizations/data/__generated__/NewDatumViewCreateDatumMutation.graphql.ts
generated
Normal file
@@ -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<string> | null | undefined;
|
||||
};
|
||||
export type NewDatumViewCreateDatumMutation$variables = {
|
||||
connections: ReadonlyArray<string>;
|
||||
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;
|
||||
341
apps/console/src/pages/organizations/data/__generated__/NewDatumViewQuery.graphql.ts
generated
Normal file
341
apps/console/src/pages/organizations/data/__generated__/NewDatumViewQuery.graphql.ts
generated
Normal file
@@ -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;
|
||||
435
pkg/coredata/data.go
Normal file
435
pkg/coredata/data.go
Normal file
@@ -0,0 +1,435 @@
|
||||
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// 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)
|
||||
})
|
||||
}
|
||||
51
pkg/coredata/datum_order_field.go
Normal file
51
pkg/coredata/datum_order_field.go
Normal file
@@ -0,0 +1,51 @@
|
||||
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// 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)
|
||||
}
|
||||
@@ -34,4 +34,5 @@ const (
|
||||
DocumentVersionEntityType
|
||||
DocumentVersionSignatureEntityType
|
||||
AssetEntityType
|
||||
DatumEntityType
|
||||
)
|
||||
|
||||
20
pkg/coredata/migrations/20250602T225034Z.sql
Normal file
20
pkg/coredata/migrations/20250602T225034Z.sql
Normal file
@@ -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)
|
||||
);
|
||||
@@ -19,7 +19,9 @@ type (
|
||||
)
|
||||
|
||||
const (
|
||||
OrganizationOrderFieldName OrganizationOrderField = "NAME"
|
||||
OrganizationOrderFieldCreatedAt OrganizationOrderField = "CREATED_AT"
|
||||
OrganizationOrderFieldUpdatedAt OrganizationOrderField = "UPDATED_AT"
|
||||
)
|
||||
|
||||
func (p OrganizationOrderField) Column() string {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
247
pkg/probo/datum_service.go
Normal file
247
pkg/probo/datum_service.go
Normal file
@@ -0,0 +1,247 @@
|
||||
// Copyright (c) 2025 Probo Inc <hello@getprobo.com>.
|
||||
//
|
||||
// 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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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!
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
36
pkg/server/api/console/v1/types/data.go
Normal file
36
pkg/server/api/console/v1/types/data.go
Normal file
@@ -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),
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user