Add public trust center documents
Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
@@ -9,14 +9,14 @@ import {
|
|||||||
Tbody,
|
Tbody,
|
||||||
Th,
|
Th,
|
||||||
IconChevronDown,
|
IconChevronDown,
|
||||||
IconCheckmark1,
|
|
||||||
IconCrossLargeX,
|
|
||||||
Badge,
|
Badge,
|
||||||
|
Field,
|
||||||
|
Option,
|
||||||
} from "@probo/ui";
|
} from "@probo/ui";
|
||||||
import { useTranslate } from "@probo/i18n";
|
import { useTranslate } from "@probo/i18n";
|
||||||
import { useFragment } from "react-relay";
|
import { useFragment } from "react-relay";
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState, useCallback, useEffect } from "react";
|
||||||
import { sprintf, getAuditStateVariant, getAuditStateLabel, formatDate } from "@probo/helpers";
|
import { sprintf, getAuditStateVariant, getAuditStateLabel, formatDate, getTrustCenterVisibilityOptions } from "@probo/helpers";
|
||||||
import { useOrganizationId } from "/hooks/useOrganizationId";
|
import { useOrganizationId } from "/hooks/useOrganizationId";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import type { TrustCenterAuditsCardFragment$key } from "./__generated__/TrustCenterAuditsCardFragment.graphql";
|
import type { TrustCenterAuditsCardFragment$key } from "./__generated__/TrustCenterAuditsCardFragment.graphql";
|
||||||
@@ -31,7 +31,7 @@ const trustCenterAuditFragment = graphql`
|
|||||||
validFrom
|
validFrom
|
||||||
validUntil
|
validUntil
|
||||||
state
|
state
|
||||||
showOnTrustCenter
|
trustCenterVisibility
|
||||||
createdAt
|
createdAt
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
@@ -40,7 +40,7 @@ type Mutation<Params> = (p: {
|
|||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
id: string;
|
id: string;
|
||||||
showOnTrustCenter: boolean;
|
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
} & Params;
|
} & Params;
|
||||||
};
|
};
|
||||||
}) => void;
|
}) => void;
|
||||||
@@ -49,7 +49,7 @@ type Props<Params> = {
|
|||||||
audits: TrustCenterAuditsCardFragment$key[];
|
audits: TrustCenterAuditsCardFragment$key[];
|
||||||
params: Params;
|
params: Params;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
onToggleVisibility: Mutation<Params>;
|
onChangeVisibility: Mutation<Params>;
|
||||||
variant?: "card" | "table";
|
variant?: "card" | "table";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -62,12 +62,12 @@ export function TrustCenterAuditsCard<Params>(props: Props<Params>) {
|
|||||||
const showMoreButton = limit !== null && props.audits.length > limit;
|
const showMoreButton = limit !== null && props.audits.length > limit;
|
||||||
const variant = props.variant ?? "table";
|
const variant = props.variant ?? "table";
|
||||||
|
|
||||||
const onToggleVisibility = (auditId: string, showOnTrustCenter: boolean) => {
|
const onChangeVisibility = (auditId: string, trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC") => {
|
||||||
props.onToggleVisibility({
|
props.onChangeVisibility({
|
||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
id: auditId,
|
id: auditId,
|
||||||
showOnTrustCenter,
|
trustCenterVisibility,
|
||||||
...props.params,
|
...props.params,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -86,7 +86,6 @@ export function TrustCenterAuditsCard<Params>(props: Props<Params>) {
|
|||||||
<Th>{__("Valid Until")}</Th>
|
<Th>{__("Valid Until")}</Th>
|
||||||
<Th>{__("State")}</Th>
|
<Th>{__("State")}</Th>
|
||||||
<Th>{__("Visibility")}</Th>
|
<Th>{__("Visibility")}</Th>
|
||||||
<Th></Th>
|
|
||||||
</Tr>
|
</Tr>
|
||||||
</Thead>
|
</Thead>
|
||||||
<Tbody>
|
<Tbody>
|
||||||
@@ -101,7 +100,7 @@ export function TrustCenterAuditsCard<Params>(props: Props<Params>) {
|
|||||||
<AuditRow
|
<AuditRow
|
||||||
key={index}
|
key={index}
|
||||||
audit={audit}
|
audit={audit}
|
||||||
onToggleVisibility={onToggleVisibility}
|
onChangeVisibility={onChangeVisibility}
|
||||||
disabled={props.disabled}
|
disabled={props.disabled}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@@ -123,12 +122,30 @@ export function TrustCenterAuditsCard<Params>(props: Props<Params>) {
|
|||||||
|
|
||||||
function AuditRow(props: {
|
function AuditRow(props: {
|
||||||
audit: TrustCenterAuditsCardFragment$key;
|
audit: TrustCenterAuditsCardFragment$key;
|
||||||
onToggleVisibility: (auditId: string, showOnTrustCenter: boolean) => void;
|
onChangeVisibility: (auditId: string, trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC") => void;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const audit = useFragment(trustCenterAuditFragment, props.audit);
|
const audit = useFragment(trustCenterAuditFragment, props.audit);
|
||||||
const organizationId = useOrganizationId();
|
const organizationId = useOrganizationId();
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
|
const [optimisticValue, setOptimisticValue] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const handleValueChange = useCallback((value: string | {}) => {
|
||||||
|
const stringValue = typeof value === 'string' ? value : '';
|
||||||
|
const typedValue = stringValue as "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
|
setOptimisticValue(typedValue);
|
||||||
|
props.onChangeVisibility(audit.id, typedValue);
|
||||||
|
}, [audit.id, props.onChangeVisibility]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (optimisticValue && audit.trustCenterVisibility === optimisticValue) {
|
||||||
|
setOptimisticValue(null);
|
||||||
|
}
|
||||||
|
}, [audit.trustCenterVisibility, optimisticValue]);
|
||||||
|
|
||||||
|
const currentValue = optimisticValue || audit.trustCenterVisibility;
|
||||||
|
|
||||||
|
const visibilityOptions = getTrustCenterVisibilityOptions(__);
|
||||||
|
|
||||||
const validUntilFormatted = audit.validUntil
|
const validUntilFormatted = audit.validUntil
|
||||||
? formatDate(audit.validUntil)
|
? formatDate(audit.validUntil)
|
||||||
@@ -148,30 +165,24 @@ function AuditRow(props: {
|
|||||||
{getAuditStateLabel(__, audit.state)}
|
{getAuditStateLabel(__, audit.state)}
|
||||||
</Badge>
|
</Badge>
|
||||||
</Td>
|
</Td>
|
||||||
<Td>
|
<Td noLink width={130} className="pr-0">
|
||||||
<div className="flex items-center gap-2">
|
<Field
|
||||||
{audit.showOnTrustCenter ? (
|
type="select"
|
||||||
<>
|
value={currentValue}
|
||||||
<IconCheckmark1 className="w-4 h-4 text-txt-primary" />
|
onValueChange={handleValueChange}
|
||||||
<span className="text-txt-primary">{__("Visible")}</span>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<IconCrossLargeX className="w-4 h-4 text-txt-tertiary" />
|
|
||||||
<span className="text-txt-tertiary">{__("Hidden")}</span>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</Td>
|
|
||||||
<Td noLink width={100} className="text-end">
|
|
||||||
<Button
|
|
||||||
variant="secondary"
|
|
||||||
onClick={() => props.onToggleVisibility(audit.id, !audit.showOnTrustCenter)}
|
|
||||||
icon={audit.showOnTrustCenter ? IconCrossLargeX : IconCheckmark1}
|
|
||||||
disabled={props.disabled}
|
disabled={props.disabled}
|
||||||
|
className="w-[105px]"
|
||||||
>
|
>
|
||||||
{audit.showOnTrustCenter ? __("Hide") : __("Show")}
|
{visibilityOptions.map((option) => (
|
||||||
</Button>
|
<Option key={option.value} value={option.value}>
|
||||||
|
<div className="flex items-center justify-between w-full">
|
||||||
|
<Badge variant={option.variant}>
|
||||||
|
{option.label}
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
</Option>
|
||||||
|
))}
|
||||||
|
</Field>
|
||||||
</Td>
|
</Td>
|
||||||
</Tr>
|
</Tr>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,99 +0,0 @@
|
|||||||
import { useTranslate } from "@probo/i18n";
|
|
||||||
import {
|
|
||||||
Dialog,
|
|
||||||
DialogContent,
|
|
||||||
DialogFooter,
|
|
||||||
Button,
|
|
||||||
useDialogRef,
|
|
||||||
} from "@probo/ui";
|
|
||||||
import { type ReactNode } from "react";
|
|
||||||
import { useFragment, graphql } from "react-relay";
|
|
||||||
import type { TrustCenterDocumentsCardFragment$key } from "./__generated__/TrustCenterDocumentsCardFragment.graphql";
|
|
||||||
|
|
||||||
const trustCenterDocumentDialogFragment = graphql`
|
|
||||||
fragment TrustCenterDocumentDialogFragment on Document {
|
|
||||||
id
|
|
||||||
title
|
|
||||||
showOnTrustCenter
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
children: ReactNode;
|
|
||||||
documents: (TrustCenterDocumentsCardFragment$key & { id: string })[];
|
|
||||||
onToggleVisibility: (documentId: string, showOnTrustCenter: boolean) => void;
|
|
||||||
disabled?: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
export default function TrustCenterDocumentDialog({
|
|
||||||
children,
|
|
||||||
documents,
|
|
||||||
onToggleVisibility,
|
|
||||||
disabled,
|
|
||||||
}: Props) {
|
|
||||||
const { __ } = useTranslate();
|
|
||||||
const dialogRef = useDialogRef();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<span onClick={() => !disabled && dialogRef.current?.open()}>
|
|
||||||
{children}
|
|
||||||
</span>
|
|
||||||
<Dialog ref={dialogRef}>
|
|
||||||
<DialogContent>
|
|
||||||
<div className="text-lg font-semibold mb-4">
|
|
||||||
{__("Manage Document Visibility on Trust Center")}
|
|
||||||
</div>
|
|
||||||
<div className="py-4">
|
|
||||||
<p className="text-txt-secondary mb-4">
|
|
||||||
{__("Control which documents are visible on your public trust center.")}
|
|
||||||
</p>
|
|
||||||
<div className="space-y-2 max-h-96 overflow-y-auto">
|
|
||||||
{documents.map((documentKey) => (
|
|
||||||
<DocumentDialogRow
|
|
||||||
key={documentKey.id}
|
|
||||||
document={documentKey}
|
|
||||||
onToggleVisibility={onToggleVisibility}
|
|
||||||
disabled={disabled}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<DialogFooter>
|
|
||||||
<Button onClick={() => dialogRef.current?.close()}>
|
|
||||||
{__("Close")}
|
|
||||||
</Button>
|
|
||||||
</DialogFooter>
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function DocumentDialogRow({
|
|
||||||
document: documentKey,
|
|
||||||
onToggleVisibility,
|
|
||||||
disabled,
|
|
||||||
}: {
|
|
||||||
document: TrustCenterDocumentsCardFragment$key & { id: string };
|
|
||||||
onToggleVisibility: (documentId: string, showOnTrustCenter: boolean) => void;
|
|
||||||
disabled?: boolean;
|
|
||||||
}) {
|
|
||||||
const document = useFragment(trustCenterDocumentDialogFragment, documentKey);
|
|
||||||
const { __ } = useTranslate();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="flex items-center justify-between p-3 border border-border-solid rounded">
|
|
||||||
<div className="flex-1">
|
|
||||||
<div className="font-medium">{document.title}</div>
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
variant="secondary"
|
|
||||||
onClick={() => onToggleVisibility(document.id, !document.showOnTrustCenter)}
|
|
||||||
disabled={disabled}
|
|
||||||
>
|
|
||||||
{document.showOnTrustCenter ? __("Hide") : __("Show")}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -9,16 +9,17 @@ import {
|
|||||||
Tbody,
|
Tbody,
|
||||||
Th,
|
Th,
|
||||||
IconChevronDown,
|
IconChevronDown,
|
||||||
IconCheckmark1,
|
|
||||||
IconCrossLargeX,
|
|
||||||
DocumentVersionBadge,
|
DocumentVersionBadge,
|
||||||
DocumentTypeBadge,
|
DocumentTypeBadge,
|
||||||
|
Field,
|
||||||
|
Option,
|
||||||
|
Badge,
|
||||||
} from "@probo/ui";
|
} from "@probo/ui";
|
||||||
import { useTranslate } from "@probo/i18n";
|
import { useTranslate } from "@probo/i18n";
|
||||||
import type { TrustCenterDocumentsCardFragment$key } from "./__generated__/TrustCenterDocumentsCardFragment.graphql";
|
import type { TrustCenterDocumentsCardFragment$key } from "./__generated__/TrustCenterDocumentsCardFragment.graphql";
|
||||||
import { useFragment } from "react-relay";
|
import { useFragment } from "react-relay";
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState, useCallback, useEffect } from "react";
|
||||||
import { sprintf } from "@probo/helpers";
|
import { sprintf, getTrustCenterVisibilityOptions } from "@probo/helpers";
|
||||||
import { useOrganizationId } from "/hooks/useOrganizationId";
|
import { useOrganizationId } from "/hooks/useOrganizationId";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ const trustCenterDocumentFragment = graphql`
|
|||||||
title
|
title
|
||||||
createdAt
|
createdAt
|
||||||
documentType
|
documentType
|
||||||
showOnTrustCenter
|
trustCenterVisibility
|
||||||
versions(first: 1) {
|
versions(first: 1) {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
@@ -44,7 +45,7 @@ type Mutation<Params> = (p: {
|
|||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
id: string;
|
id: string;
|
||||||
showOnTrustCenter: boolean;
|
trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
} & Params;
|
} & Params;
|
||||||
};
|
};
|
||||||
}) => void;
|
}) => void;
|
||||||
@@ -53,7 +54,7 @@ type Props<Params> = {
|
|||||||
documents: TrustCenterDocumentsCardFragment$key[];
|
documents: TrustCenterDocumentsCardFragment$key[];
|
||||||
params: Params;
|
params: Params;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
onToggleVisibility: Mutation<Params>;
|
onChangeVisibility: Mutation<Params>;
|
||||||
variant?: "card" | "table";
|
variant?: "card" | "table";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -66,12 +67,12 @@ export function TrustCenterDocumentsCard<Params>(props: Props<Params>) {
|
|||||||
const showMoreButton = limit !== null && props.documents.length > limit;
|
const showMoreButton = limit !== null && props.documents.length > limit;
|
||||||
const variant = props.variant ?? "table";
|
const variant = props.variant ?? "table";
|
||||||
|
|
||||||
const onToggleVisibility = (documentId: string, showOnTrustCenter: boolean) => {
|
const onChangeVisibility = (documentId: string, trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC") => {
|
||||||
props.onToggleVisibility({
|
props.onChangeVisibility({
|
||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
id: documentId,
|
id: documentId,
|
||||||
showOnTrustCenter,
|
trustCenterVisibility,
|
||||||
...props.params,
|
...props.params,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -89,7 +90,6 @@ export function TrustCenterDocumentsCard<Params>(props: Props<Params>) {
|
|||||||
<Th>{__("Type")}</Th>
|
<Th>{__("Type")}</Th>
|
||||||
<Th>{__("State")}</Th>
|
<Th>{__("State")}</Th>
|
||||||
<Th>{__("Visibility")}</Th>
|
<Th>{__("Visibility")}</Th>
|
||||||
<Th></Th>
|
|
||||||
</Tr>
|
</Tr>
|
||||||
</Thead>
|
</Thead>
|
||||||
<Tbody>
|
<Tbody>
|
||||||
@@ -104,7 +104,7 @@ export function TrustCenterDocumentsCard<Params>(props: Props<Params>) {
|
|||||||
<DocumentRow
|
<DocumentRow
|
||||||
key={index}
|
key={index}
|
||||||
document={document}
|
document={document}
|
||||||
onToggleVisibility={onToggleVisibility}
|
onChangeVisibility={onChangeVisibility}
|
||||||
disabled={props.disabled}
|
disabled={props.disabled}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@@ -127,12 +127,30 @@ export function TrustCenterDocumentsCard<Params>(props: Props<Params>) {
|
|||||||
|
|
||||||
function DocumentRow(props: {
|
function DocumentRow(props: {
|
||||||
document: TrustCenterDocumentsCardFragment$key;
|
document: TrustCenterDocumentsCardFragment$key;
|
||||||
onToggleVisibility: (documentId: string, showOnTrustCenter: boolean) => void;
|
onChangeVisibility: (documentId: string, trustCenterVisibility: "NONE" | "PRIVATE" | "PUBLIC") => void;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const document = useFragment(trustCenterDocumentFragment, props.document);
|
const document = useFragment(trustCenterDocumentFragment, props.document);
|
||||||
const organizationId = useOrganizationId();
|
const organizationId = useOrganizationId();
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
|
const [optimisticValue, setOptimisticValue] = useState<string | null>(null);
|
||||||
|
|
||||||
|
const handleValueChange = useCallback((value: string | {}) => {
|
||||||
|
const stringValue = typeof value === 'string' ? value : '';
|
||||||
|
const typedValue = stringValue as "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
|
setOptimisticValue(typedValue);
|
||||||
|
props.onChangeVisibility(document.id, typedValue);
|
||||||
|
}, [document.id, props.onChangeVisibility]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (optimisticValue && document.trustCenterVisibility === optimisticValue) {
|
||||||
|
setOptimisticValue(null);
|
||||||
|
}
|
||||||
|
}, [document.trustCenterVisibility, optimisticValue]);
|
||||||
|
|
||||||
|
const currentValue = optimisticValue || document.trustCenterVisibility;
|
||||||
|
|
||||||
|
const visibilityOptions = getTrustCenterVisibilityOptions(__);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tr to={`/organizations/${organizationId}/documents/${document.id}`}>
|
<Tr to={`/organizations/${organizationId}/documents/${document.id}`}>
|
||||||
@@ -147,30 +165,24 @@ function DocumentRow(props: {
|
|||||||
<Td>
|
<Td>
|
||||||
<DocumentVersionBadge state={document.versions?.edges?.[0]?.node?.status} />
|
<DocumentVersionBadge state={document.versions?.edges?.[0]?.node?.status} />
|
||||||
</Td>
|
</Td>
|
||||||
<Td>
|
<Td noLink width={130} className="pr-0">
|
||||||
<div className="flex items-center gap-2">
|
<Field
|
||||||
{document.showOnTrustCenter ? (
|
type="select"
|
||||||
<>
|
value={currentValue}
|
||||||
<IconCheckmark1 className="w-4 h-4 text-txt-primary" />
|
onValueChange={handleValueChange}
|
||||||
<span className="text-txt-primary">{__("Visible")}</span>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<IconCrossLargeX className="w-4 h-4 text-txt-tertiary" />
|
|
||||||
<span className="text-txt-tertiary">{__("Hidden")}</span>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</Td>
|
|
||||||
<Td noLink width={100} className="text-end">
|
|
||||||
<Button
|
|
||||||
variant="secondary"
|
|
||||||
onClick={() => props.onToggleVisibility(document.id, !document.showOnTrustCenter)}
|
|
||||||
icon={document.showOnTrustCenter ? IconCrossLargeX : IconCheckmark1}
|
|
||||||
disabled={props.disabled}
|
disabled={props.disabled}
|
||||||
|
className="w-[105px]"
|
||||||
>
|
>
|
||||||
{document.showOnTrustCenter ? __("Hide") : __("Show")}
|
{visibilityOptions.map((option) => (
|
||||||
</Button>
|
<Option key={option.value} value={option.value}>
|
||||||
|
<div className="flex items-center justify-between w-full">
|
||||||
|
<Badge variant={option.variant}>
|
||||||
|
{option.label}
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
</Option>
|
||||||
|
))}
|
||||||
|
</Field>
|
||||||
</Td>
|
</Td>
|
||||||
</Tr>
|
</Tr>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -137,19 +137,9 @@ function VendorRow(props: {
|
|||||||
</Badge>
|
</Badge>
|
||||||
</Td>
|
</Td>
|
||||||
<Td>
|
<Td>
|
||||||
<div className="flex items-center gap-2">
|
<Badge variant={vendor.showOnTrustCenter ? "success" : "danger"}>
|
||||||
{vendor.showOnTrustCenter ? (
|
{vendor.showOnTrustCenter ? __("Visible") : __("None")}
|
||||||
<>
|
</Badge>
|
||||||
<IconCheckmark1 className="w-4 h-4 text-txt-primary" />
|
|
||||||
<span className="text-txt-primary">{__("Visible")}</span>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<>
|
|
||||||
<IconCrossLargeX className="w-4 h-4 text-txt-tertiary" />
|
|
||||||
<span className="text-txt-tertiary">{__("Hidden")}</span>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</Td>
|
</Td>
|
||||||
<Td noLink width={100} className="text-end">
|
<Td noLink width={100} className="text-end">
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<b29f60aeb151f0b4ded9ebb02829b67f>>
|
* @generated SignedSource<<155c0b8eda88507e66eb65e060ded192>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
import { ReaderFragment } from 'relay-runtime';
|
import { ReaderFragment } from 'relay-runtime';
|
||||||
export type AuditState = "COMPLETED" | "IN_PROGRESS" | "NOT_STARTED" | "OUTDATED" | "REJECTED";
|
export type AuditState = "COMPLETED" | "IN_PROGRESS" | "NOT_STARTED" | "OUTDATED" | "REJECTED";
|
||||||
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
import { FragmentRefs } from "relay-runtime";
|
import { FragmentRefs } from "relay-runtime";
|
||||||
export type TrustCenterAuditsCardFragment$data = {
|
export type TrustCenterAuditsCardFragment$data = {
|
||||||
readonly createdAt: any;
|
readonly createdAt: any;
|
||||||
@@ -18,8 +19,8 @@ export type TrustCenterAuditsCardFragment$data = {
|
|||||||
};
|
};
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly name: string | null | undefined;
|
readonly name: string | null | undefined;
|
||||||
readonly showOnTrustCenter: boolean;
|
|
||||||
readonly state: AuditState;
|
readonly state: AuditState;
|
||||||
|
readonly trustCenterVisibility: TrustCenterVisibility;
|
||||||
readonly validFrom: any | null | undefined;
|
readonly validFrom: any | null | undefined;
|
||||||
readonly validUntil: any | null | undefined;
|
readonly validUntil: any | null | undefined;
|
||||||
readonly " $fragmentType": "TrustCenterAuditsCardFragment";
|
readonly " $fragmentType": "TrustCenterAuditsCardFragment";
|
||||||
@@ -88,7 +89,7 @@ return {
|
|||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "showOnTrustCenter",
|
"name": "trustCenterVisibility",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -104,6 +105,6 @@ return {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "1c5db1ae603a40619342702f790adfeb";
|
(node as any).hash = "c0f615fcad79ad39f60b48daacabdbbd";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
/**
|
|
||||||
* @generated SignedSource<<3ff483dcc660e6b45d676db7fc05a30e>>
|
|
||||||
* @lightSyntaxTransform
|
|
||||||
* @nogrep
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// @ts-nocheck
|
|
||||||
|
|
||||||
import { ReaderFragment } from 'relay-runtime';
|
|
||||||
import { FragmentRefs } from "relay-runtime";
|
|
||||||
export type TrustCenterDocumentDialogFragment$data = {
|
|
||||||
readonly id: string;
|
|
||||||
readonly showOnTrustCenter: boolean;
|
|
||||||
readonly title: string;
|
|
||||||
readonly " $fragmentType": "TrustCenterDocumentDialogFragment";
|
|
||||||
};
|
|
||||||
export type TrustCenterDocumentDialogFragment$key = {
|
|
||||||
readonly " $data"?: TrustCenterDocumentDialogFragment$data;
|
|
||||||
readonly " $fragmentSpreads": FragmentRefs<"TrustCenterDocumentDialogFragment">;
|
|
||||||
};
|
|
||||||
|
|
||||||
const node: ReaderFragment = {
|
|
||||||
"argumentDefinitions": [],
|
|
||||||
"kind": "Fragment",
|
|
||||||
"metadata": null,
|
|
||||||
"name": "TrustCenterDocumentDialogFragment",
|
|
||||||
"selections": [
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "id",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "title",
|
|
||||||
"storageKey": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"alias": null,
|
|
||||||
"args": null,
|
|
||||||
"kind": "ScalarField",
|
|
||||||
"name": "showOnTrustCenter",
|
|
||||||
"storageKey": null
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"type": "Document",
|
|
||||||
"abstractKey": null
|
|
||||||
};
|
|
||||||
|
|
||||||
(node as any).hash = "d886df25fdf197161a91bbc693c9fac8";
|
|
||||||
|
|
||||||
export default node;
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<711a0b67f3e93814ae3297a2578373c6>>
|
* @generated SignedSource<<869852416d522b3851e516a543454edb>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -11,13 +11,14 @@
|
|||||||
import { ReaderFragment } from 'relay-runtime';
|
import { ReaderFragment } from 'relay-runtime';
|
||||||
export type DocumentStatus = "DRAFT" | "PUBLISHED";
|
export type DocumentStatus = "DRAFT" | "PUBLISHED";
|
||||||
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
|
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
|
||||||
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
import { FragmentRefs } from "relay-runtime";
|
import { FragmentRefs } from "relay-runtime";
|
||||||
export type TrustCenterDocumentsCardFragment$data = {
|
export type TrustCenterDocumentsCardFragment$data = {
|
||||||
readonly createdAt: any;
|
readonly createdAt: any;
|
||||||
readonly documentType: DocumentType;
|
readonly documentType: DocumentType;
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly showOnTrustCenter: boolean;
|
|
||||||
readonly title: string;
|
readonly title: string;
|
||||||
|
readonly trustCenterVisibility: TrustCenterVisibility;
|
||||||
readonly versions: {
|
readonly versions: {
|
||||||
readonly edges: ReadonlyArray<{
|
readonly edges: ReadonlyArray<{
|
||||||
readonly node: {
|
readonly node: {
|
||||||
@@ -73,7 +74,7 @@ return {
|
|||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "showOnTrustCenter",
|
"name": "trustCenterVisibility",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -129,6 +130,6 @@ return {
|
|||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "88d5e5e3a2d9f4b730428efcea644f25";
|
(node as any).hash = "a90715444be8a289eae6615ce44e244d";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export const trustCenterAuditUpdateMutation = graphql`
|
|||||||
updateAudit(input: $input) {
|
updateAudit(input: $input) {
|
||||||
audit {
|
audit {
|
||||||
id
|
id
|
||||||
showOnTrustCenter
|
trustCenterVisibility
|
||||||
...TrustCenterAuditsCardFragment
|
...TrustCenterAuditsCardFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export const updateDocumentVisibilityMutation = graphql`
|
|||||||
updateDocument(input: $input) {
|
updateDocument(input: $input) {
|
||||||
document {
|
document {
|
||||||
id
|
id
|
||||||
showOnTrustCenter
|
trustCenterVisibility
|
||||||
...TrustCenterDocumentsCardFragment
|
...TrustCenterDocumentsCardFragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<a3c134dcea5981e6a45b623ec2905962>>
|
* @generated SignedSource<<b6236fab1ef470add01b9d9cc7527caa>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -10,11 +10,13 @@
|
|||||||
|
|
||||||
import { ConcreteRequest } from 'relay-runtime';
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
export type AuditState = "COMPLETED" | "IN_PROGRESS" | "NOT_STARTED" | "OUTDATED" | "REJECTED";
|
export type AuditState = "COMPLETED" | "IN_PROGRESS" | "NOT_STARTED" | "OUTDATED" | "REJECTED";
|
||||||
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
export type CreateAuditInput = {
|
export type CreateAuditInput = {
|
||||||
frameworkId: string;
|
frameworkId: string;
|
||||||
name?: string | null | undefined;
|
name?: string | null | undefined;
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
state?: AuditState | null | undefined;
|
state?: AuditState | null | undefined;
|
||||||
|
trustCenterVisibility?: TrustCenterVisibility | null | undefined;
|
||||||
validFrom?: any | null | undefined;
|
validFrom?: any | null | undefined;
|
||||||
validUntil?: any | null | undefined;
|
validUntil?: any | null | undefined;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<4255866a0c7fe3c9c3416fe2603b5f63>>
|
* @generated SignedSource<<014a8f33bc7d6674a2a93e8b3dde8edf>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -10,11 +10,12 @@
|
|||||||
|
|
||||||
import { ConcreteRequest } from 'relay-runtime';
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
export type AuditState = "COMPLETED" | "IN_PROGRESS" | "NOT_STARTED" | "OUTDATED" | "REJECTED";
|
export type AuditState = "COMPLETED" | "IN_PROGRESS" | "NOT_STARTED" | "OUTDATED" | "REJECTED";
|
||||||
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
export type UpdateAuditInput = {
|
export type UpdateAuditInput = {
|
||||||
id: string;
|
id: string;
|
||||||
name?: string | null | undefined;
|
name?: string | null | undefined;
|
||||||
showOnTrustCenter?: boolean | null | undefined;
|
|
||||||
state?: AuditState | null | undefined;
|
state?: AuditState | null | undefined;
|
||||||
|
trustCenterVisibility?: TrustCenterVisibility | null | undefined;
|
||||||
validFrom?: any | null | undefined;
|
validFrom?: any | null | undefined;
|
||||||
validUntil?: any | null | undefined;
|
validUntil?: any | null | undefined;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<5773d0630d11596682d41b4df95716c3>>
|
* @generated SignedSource<<0d25ae690e5016a27d889ed1c4a1667f>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -11,11 +11,12 @@
|
|||||||
import { ConcreteRequest } from 'relay-runtime';
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
import { FragmentRefs } from "relay-runtime";
|
import { FragmentRefs } from "relay-runtime";
|
||||||
export type AuditState = "COMPLETED" | "IN_PROGRESS" | "NOT_STARTED" | "OUTDATED" | "REJECTED";
|
export type AuditState = "COMPLETED" | "IN_PROGRESS" | "NOT_STARTED" | "OUTDATED" | "REJECTED";
|
||||||
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
export type UpdateAuditInput = {
|
export type UpdateAuditInput = {
|
||||||
id: string;
|
id: string;
|
||||||
name?: string | null | undefined;
|
name?: string | null | undefined;
|
||||||
showOnTrustCenter?: boolean | null | undefined;
|
|
||||||
state?: AuditState | null | undefined;
|
state?: AuditState | null | undefined;
|
||||||
|
trustCenterVisibility?: TrustCenterVisibility | null | undefined;
|
||||||
validFrom?: any | null | undefined;
|
validFrom?: any | null | undefined;
|
||||||
validUntil?: any | null | undefined;
|
validUntil?: any | null | undefined;
|
||||||
};
|
};
|
||||||
@@ -26,7 +27,7 @@ export type TrustCenterAuditGraphUpdateMutation$data = {
|
|||||||
readonly updateAudit: {
|
readonly updateAudit: {
|
||||||
readonly audit: {
|
readonly audit: {
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly showOnTrustCenter: boolean;
|
readonly trustCenterVisibility: TrustCenterVisibility;
|
||||||
readonly " $fragmentSpreads": FragmentRefs<"TrustCenterAuditsCardFragment">;
|
readonly " $fragmentSpreads": FragmentRefs<"TrustCenterAuditsCardFragment">;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -62,7 +63,7 @@ v3 = {
|
|||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "showOnTrustCenter",
|
"name": "trustCenterVisibility",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
v4 = {
|
v4 = {
|
||||||
@@ -187,16 +188,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "d27b79a065314a22dbcbd8216de1268b",
|
"cacheID": "70742901eeb45d5e00e4e61d83b2f828",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterAuditGraphUpdateMutation",
|
"name": "TrustCenterAuditGraphUpdateMutation",
|
||||||
"operationKind": "mutation",
|
"operationKind": "mutation",
|
||||||
"text": "mutation TrustCenterAuditGraphUpdateMutation(\n $input: UpdateAuditInput!\n) {\n updateAudit(input: $input) {\n audit {\n id\n showOnTrustCenter\n ...TrustCenterAuditsCardFragment\n }\n }\n}\n\nfragment TrustCenterAuditsCardFragment on Audit {\n id\n name\n framework {\n name\n id\n }\n validFrom\n validUntil\n state\n showOnTrustCenter\n createdAt\n}\n"
|
"text": "mutation TrustCenterAuditGraphUpdateMutation(\n $input: UpdateAuditInput!\n) {\n updateAudit(input: $input) {\n audit {\n id\n trustCenterVisibility\n ...TrustCenterAuditsCardFragment\n }\n }\n}\n\nfragment TrustCenterAuditsCardFragment on Audit {\n id\n name\n framework {\n name\n id\n }\n validFrom\n validUntil\n state\n trustCenterVisibility\n createdAt\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "1e92374989ecf8f439d069eb003e4e4e";
|
(node as any).hash = "c958ccce67f79bb75593e9fcb31ee9d8";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<6676a9b480eeef26f00ff97963b39b86>>
|
* @generated SignedSource<<1135bf3b786a26466e2763cbeecb7b5b>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -204,7 +204,7 @@ return {
|
|||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "showOnTrustCenter",
|
"name": "trustCenterVisibility",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -273,12 +273,12 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "f8e5f4d7adcf1e794bc046ef21317f89",
|
"cacheID": "1df18b182ace4562ffa876b7e8073a22",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterDocumentGraphQuery",
|
"name": "TrustCenterDocumentGraphQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query TrustCenterDocumentGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n documents(first: 100) {\n edges {\n node {\n id\n ...TrustCenterDocumentsCardFragment\n }\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterDocumentsCardFragment on Document {\n id\n title\n createdAt\n documentType\n showOnTrustCenter\n versions(first: 1) {\n edges {\n node {\n id\n status\n }\n }\n }\n}\n"
|
"text": "query TrustCenterDocumentGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n documents(first: 100) {\n edges {\n node {\n id\n ...TrustCenterDocumentsCardFragment\n }\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterDocumentsCardFragment on Document {\n id\n title\n createdAt\n documentType\n trustCenterVisibility\n versions(first: 1) {\n edges {\n node {\n id\n status\n }\n }\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<46d46472ea11f58c00df8b8827afab98>>
|
* @generated SignedSource<<64b79a80214710d6c3e4676cd63136e4>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -11,13 +11,14 @@
|
|||||||
import { ConcreteRequest } from 'relay-runtime';
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
import { FragmentRefs } from "relay-runtime";
|
import { FragmentRefs } from "relay-runtime";
|
||||||
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
|
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
|
||||||
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
export type UpdateDocumentInput = {
|
export type UpdateDocumentInput = {
|
||||||
content?: string | null | undefined;
|
content?: string | null | undefined;
|
||||||
documentType?: DocumentType | null | undefined;
|
documentType?: DocumentType | null | undefined;
|
||||||
id: string;
|
id: string;
|
||||||
ownerId?: string | null | undefined;
|
ownerId?: string | null | undefined;
|
||||||
showOnTrustCenter?: boolean | null | undefined;
|
|
||||||
title?: string | null | undefined;
|
title?: string | null | undefined;
|
||||||
|
trustCenterVisibility?: TrustCenterVisibility | null | undefined;
|
||||||
};
|
};
|
||||||
export type TrustCenterDocumentGraphUpdateMutation$variables = {
|
export type TrustCenterDocumentGraphUpdateMutation$variables = {
|
||||||
input: UpdateDocumentInput;
|
input: UpdateDocumentInput;
|
||||||
@@ -26,7 +27,7 @@ export type TrustCenterDocumentGraphUpdateMutation$data = {
|
|||||||
readonly updateDocument: {
|
readonly updateDocument: {
|
||||||
readonly document: {
|
readonly document: {
|
||||||
readonly id: string;
|
readonly id: string;
|
||||||
readonly showOnTrustCenter: boolean;
|
readonly trustCenterVisibility: TrustCenterVisibility;
|
||||||
readonly " $fragmentSpreads": FragmentRefs<"TrustCenterDocumentsCardFragment">;
|
readonly " $fragmentSpreads": FragmentRefs<"TrustCenterDocumentsCardFragment">;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -62,7 +63,7 @@ v3 = {
|
|||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "showOnTrustCenter",
|
"name": "trustCenterVisibility",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
@@ -206,16 +207,16 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "b112314d6ef35feebf49bd2f8c636b33",
|
"cacheID": "04cb2a4e83386dfffce8c12eae320cfe",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterDocumentGraphUpdateMutation",
|
"name": "TrustCenterDocumentGraphUpdateMutation",
|
||||||
"operationKind": "mutation",
|
"operationKind": "mutation",
|
||||||
"text": "mutation TrustCenterDocumentGraphUpdateMutation(\n $input: UpdateDocumentInput!\n) {\n updateDocument(input: $input) {\n document {\n id\n showOnTrustCenter\n ...TrustCenterDocumentsCardFragment\n }\n }\n}\n\nfragment TrustCenterDocumentsCardFragment on Document {\n id\n title\n createdAt\n documentType\n showOnTrustCenter\n versions(first: 1) {\n edges {\n node {\n id\n status\n }\n }\n }\n}\n"
|
"text": "mutation TrustCenterDocumentGraphUpdateMutation(\n $input: UpdateDocumentInput!\n) {\n updateDocument(input: $input) {\n document {\n id\n trustCenterVisibility\n ...TrustCenterDocumentsCardFragment\n }\n }\n}\n\nfragment TrustCenterDocumentsCardFragment on Document {\n id\n title\n createdAt\n documentType\n trustCenterVisibility\n versions(first: 1) {\n edges {\n node {\n id\n status\n }\n }\n }\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|
||||||
(node as any).hash = "46f72a664d3edb0e5665b1ecea69e31a";
|
(node as any).hash = "293896dbfec4de53d0fe30a2462f833b";
|
||||||
|
|
||||||
export default node;
|
export default node;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<241faf24f6f9e1ca0e5f8171e40e5cd3>>
|
* @generated SignedSource<<da6b3823d7bc60f99482bce2b08b9668>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -236,7 +236,7 @@ v10 = {
|
|||||||
"alias": null,
|
"alias": null,
|
||||||
"args": null,
|
"args": null,
|
||||||
"kind": "ScalarField",
|
"kind": "ScalarField",
|
||||||
"name": "showOnTrustCenter",
|
"name": "trustCenterVisibility",
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
@@ -617,7 +617,13 @@ return {
|
|||||||
"storageKey": null
|
"storageKey": null
|
||||||
},
|
},
|
||||||
(v7/*: any*/),
|
(v7/*: any*/),
|
||||||
(v10/*: any*/),
|
{
|
||||||
|
"alias": null,
|
||||||
|
"args": null,
|
||||||
|
"kind": "ScalarField",
|
||||||
|
"name": "showOnTrustCenter",
|
||||||
|
"storageKey": null
|
||||||
|
},
|
||||||
(v4/*: any*/)
|
(v4/*: any*/)
|
||||||
],
|
],
|
||||||
"storageKey": null
|
"storageKey": null
|
||||||
@@ -638,12 +644,12 @@ return {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"params": {
|
"params": {
|
||||||
"cacheID": "d08519f604d27066ddaabb667d234552",
|
"cacheID": "3aed31b283ab7aa8e5ae0549474b449f",
|
||||||
"id": null,
|
"id": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"name": "TrustCenterGraphQuery",
|
"name": "TrustCenterGraphQuery",
|
||||||
"operationKind": "query",
|
"operationKind": "query",
|
||||||
"text": "query TrustCenterGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n name\n trustCenter {\n id\n active\n slug\n ndaFileName\n ndaFileUrl\n createdAt\n updatedAt\n references(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n name\n description\n websiteUrl\n logoUrl\n createdAt\n updatedAt\n }\n }\n }\n }\n documents(first: 100) {\n edges {\n node {\n id\n ...TrustCenterDocumentsCardFragment\n }\n }\n }\n audits(first: 100) {\n edges {\n node {\n id\n ...TrustCenterAuditsCardFragment\n }\n }\n }\n vendors(first: 100) {\n edges {\n node {\n id\n ...TrustCenterVendorsCardFragment\n }\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterAuditsCardFragment on Audit {\n id\n name\n framework {\n name\n id\n }\n validFrom\n validUntil\n state\n showOnTrustCenter\n createdAt\n}\n\nfragment TrustCenterDocumentsCardFragment on Document {\n id\n title\n createdAt\n documentType\n showOnTrustCenter\n versions(first: 1) {\n edges {\n node {\n id\n status\n }\n }\n }\n}\n\nfragment TrustCenterVendorsCardFragment on Vendor {\n id\n name\n category\n description\n showOnTrustCenter\n createdAt\n}\n"
|
"text": "query TrustCenterGraphQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ... on Organization {\n id\n name\n trustCenter {\n id\n active\n slug\n ndaFileName\n ndaFileUrl\n createdAt\n updatedAt\n references(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {\n edges {\n node {\n id\n name\n description\n websiteUrl\n logoUrl\n createdAt\n updatedAt\n }\n }\n }\n }\n documents(first: 100) {\n edges {\n node {\n id\n ...TrustCenterDocumentsCardFragment\n }\n }\n }\n audits(first: 100) {\n edges {\n node {\n id\n ...TrustCenterAuditsCardFragment\n }\n }\n }\n vendors(first: 100) {\n edges {\n node {\n id\n ...TrustCenterVendorsCardFragment\n }\n }\n }\n }\n id\n }\n}\n\nfragment TrustCenterAuditsCardFragment on Audit {\n id\n name\n framework {\n name\n id\n }\n validFrom\n validUntil\n state\n trustCenterVisibility\n createdAt\n}\n\nfragment TrustCenterDocumentsCardFragment on Document {\n id\n title\n createdAt\n documentType\n trustCenterVisibility\n versions(first: 1) {\n edges {\n node {\n id\n status\n }\n }\n }\n}\n\nfragment TrustCenterVendorsCardFragment on Vendor {\n id\n name\n category\n description\n showOnTrustCenter\n createdAt\n}\n"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<aa94f8d2cc4c6a5c29de3029d5e6d2ca>>
|
* @generated SignedSource<<efe95ef5290fa021d00c7f32922ae801>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -10,13 +10,14 @@
|
|||||||
|
|
||||||
import { ConcreteRequest } from 'relay-runtime';
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
|
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
|
||||||
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
export type UpdateDocumentInput = {
|
export type UpdateDocumentInput = {
|
||||||
content?: string | null | undefined;
|
content?: string | null | undefined;
|
||||||
documentType?: DocumentType | null | undefined;
|
documentType?: DocumentType | null | undefined;
|
||||||
id: string;
|
id: string;
|
||||||
ownerId?: string | null | undefined;
|
ownerId?: string | null | undefined;
|
||||||
showOnTrustCenter?: boolean | null | undefined;
|
|
||||||
title?: string | null | undefined;
|
title?: string | null | undefined;
|
||||||
|
trustCenterVisibility?: TrustCenterVisibility | null | undefined;
|
||||||
};
|
};
|
||||||
export type DocumentDetailPageUpdateMutation$variables = {
|
export type DocumentDetailPageUpdateMutation$variables = {
|
||||||
input: UpdateDocumentInput;
|
input: UpdateDocumentInput;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* @generated SignedSource<<ce2f4f138b340f04b4e413ecbfff2ea1>>
|
* @generated SignedSource<<7f9d3e67d06cbf2aaf21c61be65bc7ee>>
|
||||||
* @lightSyntaxTransform
|
* @lightSyntaxTransform
|
||||||
* @nogrep
|
* @nogrep
|
||||||
*/
|
*/
|
||||||
@@ -11,12 +11,14 @@
|
|||||||
import { ConcreteRequest } from 'relay-runtime';
|
import { ConcreteRequest } from 'relay-runtime';
|
||||||
import { FragmentRefs } from "relay-runtime";
|
import { FragmentRefs } from "relay-runtime";
|
||||||
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
|
export type DocumentType = "ISMS" | "OTHER" | "POLICY";
|
||||||
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
export type CreateDocumentInput = {
|
export type CreateDocumentInput = {
|
||||||
content: string;
|
content: string;
|
||||||
documentType: DocumentType;
|
documentType: DocumentType;
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
ownerId: string;
|
ownerId: string;
|
||||||
title: string;
|
title: string;
|
||||||
|
trustCenterVisibility?: TrustCenterVisibility | null | undefined;
|
||||||
};
|
};
|
||||||
export type CreateDocumentDialogMutation$variables = {
|
export type CreateDocumentDialogMutation$variables = {
|
||||||
connections: ReadonlyArray<string>;
|
connections: ReadonlyArray<string>;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default function TrustCenterAuditsTab() {
|
|||||||
audits={audits}
|
audits={audits}
|
||||||
params={{}}
|
params={{}}
|
||||||
disabled={isUpdatingAudits}
|
disabled={isUpdatingAudits}
|
||||||
onToggleVisibility={updateAuditVisibility}
|
onChangeVisibility={updateAuditVisibility}
|
||||||
variant="table"
|
variant="table"
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export default function TrustCenterDocumentsTab() {
|
|||||||
documents={documents}
|
documents={documents}
|
||||||
params={{}}
|
params={{}}
|
||||||
disabled={isUpdatingDocuments}
|
disabled={isUpdatingDocuments}
|
||||||
onToggleVisibility={updateDocumentVisibility}
|
onChangeVisibility={updateDocumentVisibility}
|
||||||
variant="table"
|
variant="table"
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -43,6 +43,13 @@ export {
|
|||||||
getObligationStatusLabel,
|
getObligationStatusLabel,
|
||||||
getObligationStatusOptions,
|
getObligationStatusOptions,
|
||||||
} from "./obligationStatus";
|
} from "./obligationStatus";
|
||||||
|
export {
|
||||||
|
getTrustCenterVisibilityVariant,
|
||||||
|
getTrustCenterVisibilityLabel,
|
||||||
|
getTrustCenterVisibilityOptions,
|
||||||
|
trustCenterVisibilities,
|
||||||
|
type TrustCenterVisibility,
|
||||||
|
} from "./trustCenterVisibility";
|
||||||
export { promisifyMutation } from "./relay";
|
export { promisifyMutation } from "./relay";
|
||||||
export { fileType, fileSize } from "./file";
|
export { fileType, fileSize } from "./file";
|
||||||
export { formatDatetime, formatDate } from "./date";
|
export { formatDatetime, formatDate } from "./date";
|
||||||
|
|||||||
47
packages/helpers/src/trustCenterVisibility.ts
Normal file
47
packages/helpers/src/trustCenterVisibility.ts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
type Translator = (s: string) => string;
|
||||||
|
|
||||||
|
export type TrustCenterVisibility = "NONE" | "PRIVATE" | "PUBLIC";
|
||||||
|
|
||||||
|
export const trustCenterVisibilities = [
|
||||||
|
"NONE",
|
||||||
|
"PRIVATE",
|
||||||
|
"PUBLIC",
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
export const getTrustCenterVisibilityVariant = (visibility: TrustCenterVisibility) => {
|
||||||
|
switch (visibility) {
|
||||||
|
case "NONE":
|
||||||
|
return "danger" as const;
|
||||||
|
case "PRIVATE":
|
||||||
|
return "warning" as const;
|
||||||
|
case "PUBLIC":
|
||||||
|
return "success" as const;
|
||||||
|
default:
|
||||||
|
return "neutral" as const;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getTrustCenterVisibilityLabel = (visibility: TrustCenterVisibility) => {
|
||||||
|
switch (visibility) {
|
||||||
|
case "NONE":
|
||||||
|
return "None";
|
||||||
|
case "PRIVATE":
|
||||||
|
return "Private";
|
||||||
|
case "PUBLIC":
|
||||||
|
return "Public";
|
||||||
|
default:
|
||||||
|
return visibility;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export function getTrustCenterVisibilityOptions(__: Translator) {
|
||||||
|
return trustCenterVisibilities.map((visibility) => ({
|
||||||
|
value: visibility,
|
||||||
|
label: __({
|
||||||
|
"NONE": "None",
|
||||||
|
"PRIVATE": "Private",
|
||||||
|
"PUBLIC": "Public",
|
||||||
|
}[visibility]),
|
||||||
|
variant: getTrustCenterVisibilityVariant(visibility),
|
||||||
|
}));
|
||||||
|
}
|
||||||
@@ -28,17 +28,17 @@ import (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
Audit struct {
|
Audit struct {
|
||||||
ID gid.GID `db:"id"`
|
ID gid.GID `db:"id"`
|
||||||
Name *string `db:"name"`
|
Name *string `db:"name"`
|
||||||
OrganizationID gid.GID `db:"organization_id"`
|
OrganizationID gid.GID `db:"organization_id"`
|
||||||
FrameworkID gid.GID `db:"framework_id"`
|
FrameworkID gid.GID `db:"framework_id"`
|
||||||
ReportID *gid.GID `db:"report_id"`
|
ReportID *gid.GID `db:"report_id"`
|
||||||
ValidFrom *time.Time `db:"valid_from"`
|
ValidFrom *time.Time `db:"valid_from"`
|
||||||
ValidUntil *time.Time `db:"valid_until"`
|
ValidUntil *time.Time `db:"valid_until"`
|
||||||
State AuditState `db:"state"`
|
State AuditState `db:"state"`
|
||||||
ShowOnTrustCenter bool `db:"show_on_trust_center"`
|
TrustCenterVisibility TrustCenterVisibility `db:"trust_center_visibility"`
|
||||||
CreatedAt time.Time `db:"created_at"`
|
CreatedAt time.Time `db:"created_at"`
|
||||||
UpdatedAt time.Time `db:"updated_at"`
|
UpdatedAt time.Time `db:"updated_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
Audits []*Audit
|
Audits []*Audit
|
||||||
@@ -75,7 +75,7 @@ SELECT
|
|||||||
valid_from,
|
valid_from,
|
||||||
valid_until,
|
valid_until,
|
||||||
state,
|
state,
|
||||||
show_on_trust_center,
|
trust_center_visibility,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM
|
FROM
|
||||||
@@ -156,7 +156,7 @@ SELECT
|
|||||||
valid_from,
|
valid_from,
|
||||||
valid_until,
|
valid_until,
|
||||||
state,
|
state,
|
||||||
show_on_trust_center,
|
trust_center_visibility,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM
|
FROM
|
||||||
@@ -207,7 +207,7 @@ SELECT
|
|||||||
valid_from,
|
valid_from,
|
||||||
valid_until,
|
valid_until,
|
||||||
state,
|
state,
|
||||||
show_on_trust_center,
|
trust_center_visibility,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM
|
FROM
|
||||||
@@ -256,7 +256,7 @@ INSERT INTO audits (
|
|||||||
valid_from,
|
valid_from,
|
||||||
valid_until,
|
valid_until,
|
||||||
state,
|
state,
|
||||||
show_on_trust_center,
|
trust_center_visibility,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
) VALUES (
|
) VALUES (
|
||||||
@@ -269,25 +269,25 @@ INSERT INTO audits (
|
|||||||
@valid_from,
|
@valid_from,
|
||||||
@valid_until,
|
@valid_until,
|
||||||
@state,
|
@state,
|
||||||
@show_on_trust_center,
|
@trust_center_visibility,
|
||||||
@created_at,
|
@created_at,
|
||||||
@updated_at
|
@updated_at
|
||||||
)
|
)
|
||||||
`
|
`
|
||||||
|
|
||||||
args := pgx.StrictNamedArgs{
|
args := pgx.StrictNamedArgs{
|
||||||
"id": a.ID,
|
"id": a.ID,
|
||||||
"name": a.Name,
|
"name": a.Name,
|
||||||
"tenant_id": scope.GetTenantID(),
|
"tenant_id": scope.GetTenantID(),
|
||||||
"organization_id": a.OrganizationID,
|
"organization_id": a.OrganizationID,
|
||||||
"framework_id": a.FrameworkID,
|
"framework_id": a.FrameworkID,
|
||||||
"report_id": a.ReportID,
|
"report_id": a.ReportID,
|
||||||
"valid_from": a.ValidFrom,
|
"valid_from": a.ValidFrom,
|
||||||
"valid_until": a.ValidUntil,
|
"valid_until": a.ValidUntil,
|
||||||
"state": a.State,
|
"state": a.State,
|
||||||
"show_on_trust_center": a.ShowOnTrustCenter,
|
"trust_center_visibility": a.TrustCenterVisibility,
|
||||||
"created_at": a.CreatedAt,
|
"created_at": a.CreatedAt,
|
||||||
"updated_at": a.UpdatedAt,
|
"updated_at": a.UpdatedAt,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := conn.Exec(ctx, q, args)
|
_, err := conn.Exec(ctx, q, args)
|
||||||
@@ -311,7 +311,7 @@ SET
|
|||||||
valid_from = @valid_from,
|
valid_from = @valid_from,
|
||||||
valid_until = @valid_until,
|
valid_until = @valid_until,
|
||||||
state = @state,
|
state = @state,
|
||||||
show_on_trust_center = @show_on_trust_center,
|
trust_center_visibility = @trust_center_visibility,
|
||||||
updated_at = @updated_at
|
updated_at = @updated_at
|
||||||
WHERE
|
WHERE
|
||||||
%s
|
%s
|
||||||
@@ -321,14 +321,14 @@ WHERE
|
|||||||
q = fmt.Sprintf(q, scope.SQLFragment())
|
q = fmt.Sprintf(q, scope.SQLFragment())
|
||||||
|
|
||||||
args := pgx.StrictNamedArgs{
|
args := pgx.StrictNamedArgs{
|
||||||
"id": a.ID,
|
"id": a.ID,
|
||||||
"name": a.Name,
|
"name": a.Name,
|
||||||
"report_id": a.ReportID,
|
"report_id": a.ReportID,
|
||||||
"valid_from": a.ValidFrom,
|
"valid_from": a.ValidFrom,
|
||||||
"valid_until": a.ValidUntil,
|
"valid_until": a.ValidUntil,
|
||||||
"state": a.State,
|
"state": a.State,
|
||||||
"show_on_trust_center": a.ShowOnTrustCenter,
|
"trust_center_visibility": a.TrustCenterVisibility,
|
||||||
"updated_at": a.UpdatedAt,
|
"updated_at": a.UpdatedAt,
|
||||||
}
|
}
|
||||||
maps.Copy(args, scope.SQLArguments())
|
maps.Copy(args, scope.SQLArguments())
|
||||||
|
|
||||||
@@ -423,7 +423,7 @@ WITH audits_by_control AS (
|
|||||||
a.valid_from,
|
a.valid_from,
|
||||||
a.valid_until,
|
a.valid_until,
|
||||||
a.state,
|
a.state,
|
||||||
a.show_on_trust_center,
|
a.trust_center_visibility,
|
||||||
a.created_at,
|
a.created_at,
|
||||||
a.updated_at
|
a.updated_at
|
||||||
FROM
|
FROM
|
||||||
@@ -442,7 +442,7 @@ SELECT
|
|||||||
valid_from,
|
valid_from,
|
||||||
valid_until,
|
valid_until,
|
||||||
state,
|
state,
|
||||||
show_on_trust_center,
|
trust_center_visibility,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM
|
FROM
|
||||||
@@ -487,7 +487,7 @@ SELECT
|
|||||||
valid_from,
|
valid_from,
|
||||||
valid_until,
|
valid_until,
|
||||||
state,
|
state,
|
||||||
show_on_trust_center,
|
trust_center_visibility,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM
|
FROM
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
AuditFilter struct {
|
AuditFilter struct {
|
||||||
showOnTrustCenter *bool
|
trustCenterVisibilities []TrustCenterVisibility
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -29,25 +29,31 @@ func NewAuditFilter() *AuditFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewAuditTrustCenterFilter() *AuditFilter {
|
func NewAuditTrustCenterFilter() *AuditFilter {
|
||||||
showOnTrustCenter := true
|
|
||||||
return &AuditFilter{
|
return &AuditFilter{
|
||||||
showOnTrustCenter: &showOnTrustCenter,
|
trustCenterVisibilities: []TrustCenterVisibility{
|
||||||
|
TrustCenterVisibilityPrivate,
|
||||||
|
TrustCenterVisibilityPublic,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *AuditFilter) SQLArguments() pgx.NamedArgs {
|
func (f *AuditFilter) SQLArguments() pgx.NamedArgs {
|
||||||
args := pgx.NamedArgs{}
|
args := pgx.NamedArgs{}
|
||||||
|
|
||||||
if f.showOnTrustCenter != nil {
|
if f.trustCenterVisibilities != nil {
|
||||||
args["show_on_trust_center"] = *f.showOnTrustCenter
|
visibilities := make([]string, len(f.trustCenterVisibilities))
|
||||||
|
for i, v := range f.trustCenterVisibilities {
|
||||||
|
visibilities[i] = v.String()
|
||||||
|
}
|
||||||
|
args["trust_center_visibilities"] = visibilities
|
||||||
}
|
}
|
||||||
|
|
||||||
return args
|
return args
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *AuditFilter) SQLFragment() string {
|
func (f *AuditFilter) SQLFragment() string {
|
||||||
if f.showOnTrustCenter != nil {
|
if f.trustCenterVisibilities != nil {
|
||||||
return "show_on_trust_center = @show_on_trust_center"
|
return "trust_center_visibility = ANY(@trust_center_visibilities::trust_center_visibility[])"
|
||||||
}
|
}
|
||||||
|
|
||||||
return "TRUE"
|
return "TRUE"
|
||||||
|
|||||||
@@ -28,15 +28,15 @@ import (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
Document struct {
|
Document struct {
|
||||||
ID gid.GID `db:"id"`
|
ID gid.GID `db:"id"`
|
||||||
OrganizationID gid.GID `db:"organization_id"`
|
OrganizationID gid.GID `db:"organization_id"`
|
||||||
OwnerID gid.GID `db:"owner_id"`
|
OwnerID gid.GID `db:"owner_id"`
|
||||||
Title string `db:"title"`
|
Title string `db:"title"`
|
||||||
DocumentType DocumentType `db:"document_type"`
|
DocumentType DocumentType `db:"document_type"`
|
||||||
CurrentPublishedVersion *int `db:"current_published_version"`
|
CurrentPublishedVersion *int `db:"current_published_version"`
|
||||||
ShowOnTrustCenter bool `db:"show_on_trust_center"`
|
TrustCenterVisibility TrustCenterVisibility `db:"trust_center_visibility"`
|
||||||
CreatedAt time.Time `db:"created_at"`
|
CreatedAt time.Time `db:"created_at"`
|
||||||
UpdatedAt time.Time `db:"updated_at"`
|
UpdatedAt time.Time `db:"updated_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
Documents []*Document
|
Documents []*Document
|
||||||
@@ -69,7 +69,7 @@ SELECT
|
|||||||
title,
|
title,
|
||||||
document_type,
|
document_type,
|
||||||
current_published_version,
|
current_published_version,
|
||||||
show_on_trust_center,
|
trust_center_visibility,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM
|
FROM
|
||||||
@@ -151,7 +151,7 @@ SELECT
|
|||||||
title,
|
title,
|
||||||
document_type,
|
document_type,
|
||||||
current_published_version,
|
current_published_version,
|
||||||
show_on_trust_center,
|
trust_center_visibility,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM
|
FROM
|
||||||
@@ -201,7 +201,7 @@ SELECT
|
|||||||
title,
|
title,
|
||||||
document_type,
|
document_type,
|
||||||
current_published_version,
|
current_published_version,
|
||||||
show_on_trust_center,
|
trust_center_visibility,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM
|
FROM
|
||||||
@@ -250,7 +250,7 @@ INSERT INTO
|
|||||||
title,
|
title,
|
||||||
document_type,
|
document_type,
|
||||||
current_published_version,
|
current_published_version,
|
||||||
show_on_trust_center,
|
trust_center_visibility,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
)
|
)
|
||||||
@@ -262,7 +262,7 @@ VALUES (
|
|||||||
@title,
|
@title,
|
||||||
@document_type,
|
@document_type,
|
||||||
@current_published_version,
|
@current_published_version,
|
||||||
@show_on_trust_center,
|
@trust_center_visibility,
|
||||||
@created_at,
|
@created_at,
|
||||||
@updated_at
|
@updated_at
|
||||||
);
|
);
|
||||||
@@ -276,7 +276,7 @@ VALUES (
|
|||||||
"title": p.Title,
|
"title": p.Title,
|
||||||
"document_type": p.DocumentType,
|
"document_type": p.DocumentType,
|
||||||
"current_published_version": p.CurrentPublishedVersion,
|
"current_published_version": p.CurrentPublishedVersion,
|
||||||
"show_on_trust_center": p.ShowOnTrustCenter,
|
"trust_center_visibility": p.TrustCenterVisibility,
|
||||||
"created_at": p.CreatedAt,
|
"created_at": p.CreatedAt,
|
||||||
"updated_at": p.UpdatedAt,
|
"updated_at": p.UpdatedAt,
|
||||||
}
|
}
|
||||||
@@ -334,7 +334,7 @@ SET
|
|||||||
current_published_version = @current_published_version,
|
current_published_version = @current_published_version,
|
||||||
owner_id = @owner_id,
|
owner_id = @owner_id,
|
||||||
document_type = @document_type,
|
document_type = @document_type,
|
||||||
show_on_trust_center = @show_on_trust_center,
|
trust_center_visibility = @trust_center_visibility,
|
||||||
updated_at = @updated_at
|
updated_at = @updated_at
|
||||||
WHERE
|
WHERE
|
||||||
%s
|
%s
|
||||||
@@ -350,7 +350,7 @@ WHERE
|
|||||||
"current_published_version": p.CurrentPublishedVersion,
|
"current_published_version": p.CurrentPublishedVersion,
|
||||||
"owner_id": p.OwnerID,
|
"owner_id": p.OwnerID,
|
||||||
"document_type": p.DocumentType,
|
"document_type": p.DocumentType,
|
||||||
"show_on_trust_center": p.ShowOnTrustCenter,
|
"trust_center_visibility": p.TrustCenterVisibility,
|
||||||
}
|
}
|
||||||
maps.Copy(args, scope.SQLArguments())
|
maps.Copy(args, scope.SQLArguments())
|
||||||
|
|
||||||
@@ -375,7 +375,7 @@ WITH plcs AS (
|
|||||||
p.id,
|
p.id,
|
||||||
p.tenant_id,
|
p.tenant_id,
|
||||||
p.search_vector,
|
p.search_vector,
|
||||||
p.show_on_trust_center,
|
p.trust_center_visibility,
|
||||||
p.deleted_at
|
p.deleted_at
|
||||||
FROM
|
FROM
|
||||||
documents p
|
documents p
|
||||||
@@ -428,7 +428,7 @@ WITH plcs AS (
|
|||||||
p.title,
|
p.title,
|
||||||
p.document_type,
|
p.document_type,
|
||||||
p.current_published_version,
|
p.current_published_version,
|
||||||
p.show_on_trust_center,
|
p.trust_center_visibility,
|
||||||
p.created_at,
|
p.created_at,
|
||||||
p.updated_at,
|
p.updated_at,
|
||||||
p.deleted_at
|
p.deleted_at
|
||||||
@@ -446,7 +446,7 @@ SELECT
|
|||||||
title,
|
title,
|
||||||
document_type,
|
document_type,
|
||||||
current_published_version,
|
current_published_version,
|
||||||
show_on_trust_center,
|
trust_center_visibility,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM
|
FROM
|
||||||
@@ -492,7 +492,7 @@ WITH plcs AS (
|
|||||||
p.id,
|
p.id,
|
||||||
p.tenant_id,
|
p.tenant_id,
|
||||||
p.search_vector,
|
p.search_vector,
|
||||||
p.show_on_trust_center,
|
p.trust_center_visibility,
|
||||||
p.deleted_at
|
p.deleted_at
|
||||||
FROM
|
FROM
|
||||||
documents p
|
documents p
|
||||||
@@ -544,7 +544,7 @@ WITH plcs AS (
|
|||||||
p.title,
|
p.title,
|
||||||
p.document_type,
|
p.document_type,
|
||||||
p.current_published_version,
|
p.current_published_version,
|
||||||
p.show_on_trust_center,
|
p.trust_center_visibility,
|
||||||
p.created_at,
|
p.created_at,
|
||||||
p.updated_at,
|
p.updated_at,
|
||||||
p.search_vector,
|
p.search_vector,
|
||||||
@@ -563,7 +563,7 @@ SELECT
|
|||||||
title,
|
title,
|
||||||
document_type,
|
document_type,
|
||||||
current_published_version,
|
current_published_version,
|
||||||
show_on_trust_center,
|
trust_center_visibility,
|
||||||
created_at,
|
created_at,
|
||||||
updated_at
|
updated_at
|
||||||
FROM
|
FROM
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import (
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
DocumentFilter struct {
|
DocumentFilter struct {
|
||||||
query *string
|
query *string
|
||||||
showOnTrustCenter *bool
|
trustCenterVisibilities []TrustCenterVisibility
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -32,16 +32,25 @@ func NewDocumentFilter(query *string) *DocumentFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewDocumentTrustCenterFilter() *DocumentFilter {
|
func NewDocumentTrustCenterFilter() *DocumentFilter {
|
||||||
showOnTrustCenter := true
|
|
||||||
return &DocumentFilter{
|
return &DocumentFilter{
|
||||||
showOnTrustCenter: &showOnTrustCenter,
|
trustCenterVisibilities: []TrustCenterVisibility{
|
||||||
|
TrustCenterVisibilityPrivate,
|
||||||
|
TrustCenterVisibilityPublic,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *DocumentFilter) SQLArguments() pgx.StrictNamedArgs {
|
func (f *DocumentFilter) SQLArguments() pgx.StrictNamedArgs {
|
||||||
|
var visibilities []string
|
||||||
|
if f.trustCenterVisibilities != nil {
|
||||||
|
visibilities = make([]string, len(f.trustCenterVisibilities))
|
||||||
|
for i, v := range f.trustCenterVisibilities {
|
||||||
|
visibilities[i] = v.String()
|
||||||
|
}
|
||||||
|
}
|
||||||
return pgx.StrictNamedArgs{
|
return pgx.StrictNamedArgs{
|
||||||
"query": f.query,
|
"query": f.query,
|
||||||
"show_on_trust_center": f.showOnTrustCenter,
|
"trust_center_visibilities": visibilities,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,8 +67,8 @@ func (f *DocumentFilter) SQLFragment() string {
|
|||||||
END
|
END
|
||||||
AND
|
AND
|
||||||
CASE
|
CASE
|
||||||
WHEN @show_on_trust_center::boolean IS NOT NULL THEN
|
WHEN @trust_center_visibilities::trust_center_visibility[] IS NOT NULL THEN
|
||||||
show_on_trust_center = @show_on_trust_center::boolean
|
trust_center_visibility = ANY(@trust_center_visibilities::trust_center_visibility[])
|
||||||
ELSE TRUE
|
ELSE TRUE
|
||||||
END
|
END
|
||||||
)`
|
)`
|
||||||
|
|||||||
25
pkg/coredata/migrations/20251002T131830Z.sql
Normal file
25
pkg/coredata/migrations/20251002T131830Z.sql
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
CREATE TYPE trust_center_visibility AS ENUM (
|
||||||
|
'NONE',
|
||||||
|
'PRIVATE',
|
||||||
|
'PUBLIC'
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE documents ADD COLUMN trust_center_visibility trust_center_visibility NOT NULL DEFAULT 'NONE';
|
||||||
|
|
||||||
|
UPDATE documents SET trust_center_visibility = CASE
|
||||||
|
WHEN show_on_trust_center = true THEN 'PRIVATE'::trust_center_visibility
|
||||||
|
ELSE 'NONE'::trust_center_visibility
|
||||||
|
END;
|
||||||
|
|
||||||
|
ALTER TABLE documents ALTER COLUMN trust_center_visibility DROP DEFAULT;
|
||||||
|
ALTER TABLE documents DROP COLUMN show_on_trust_center;
|
||||||
|
|
||||||
|
ALTER TABLE audits ADD COLUMN trust_center_visibility trust_center_visibility NOT NULL DEFAULT 'NONE';
|
||||||
|
|
||||||
|
UPDATE audits SET trust_center_visibility = CASE
|
||||||
|
WHEN show_on_trust_center = true THEN 'PRIVATE'::trust_center_visibility
|
||||||
|
ELSE 'NONE'::trust_center_visibility
|
||||||
|
END;
|
||||||
|
|
||||||
|
ALTER TABLE audits ALTER COLUMN trust_center_visibility DROP DEFAULT;
|
||||||
|
ALTER TABLE audits DROP COLUMN show_on_trust_center;
|
||||||
60
pkg/coredata/trust_center_visibility.go
Normal file
60
pkg/coredata/trust_center_visibility.go
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
// 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 (
|
||||||
|
"database/sql/driver"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TrustCenterVisibility string
|
||||||
|
|
||||||
|
const (
|
||||||
|
TrustCenterVisibilityNone TrustCenterVisibility = "NONE"
|
||||||
|
TrustCenterVisibilityPrivate TrustCenterVisibility = "PRIVATE"
|
||||||
|
TrustCenterVisibilityPublic TrustCenterVisibility = "PUBLIC"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (tcv TrustCenterVisibility) String() string {
|
||||||
|
return string(tcv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tcv *TrustCenterVisibility) Scan(value any) error {
|
||||||
|
var s string
|
||||||
|
switch v := value.(type) {
|
||||||
|
case string:
|
||||||
|
s = v
|
||||||
|
case []byte:
|
||||||
|
s = string(v)
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("unsupported type for TrustCenterVisibility: %T", value)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch s {
|
||||||
|
case "NONE":
|
||||||
|
*tcv = TrustCenterVisibilityNone
|
||||||
|
case "PRIVATE":
|
||||||
|
*tcv = TrustCenterVisibilityPrivate
|
||||||
|
case "PUBLIC":
|
||||||
|
*tcv = TrustCenterVisibilityPublic
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("invalid TrustCenterVisibility value: %q", s)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tcv TrustCenterVisibility) Value() (driver.Value, error) {
|
||||||
|
return tcv.String(), nil
|
||||||
|
}
|
||||||
@@ -34,21 +34,22 @@ type AuditService struct {
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
CreateAuditRequest struct {
|
CreateAuditRequest struct {
|
||||||
OrganizationID gid.GID
|
OrganizationID gid.GID
|
||||||
FrameworkID gid.GID
|
FrameworkID gid.GID
|
||||||
Name *string
|
Name *string
|
||||||
ValidFrom *time.Time
|
ValidFrom *time.Time
|
||||||
ValidUntil *time.Time
|
ValidUntil *time.Time
|
||||||
State *coredata.AuditState
|
State *coredata.AuditState
|
||||||
|
TrustCenterVisibility *coredata.TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateAuditRequest struct {
|
UpdateAuditRequest struct {
|
||||||
ID gid.GID
|
ID gid.GID
|
||||||
Name **string
|
Name **string
|
||||||
ValidFrom *time.Time
|
ValidFrom *time.Time
|
||||||
ValidUntil *time.Time
|
ValidUntil *time.Time
|
||||||
State *coredata.AuditState
|
State *coredata.AuditState
|
||||||
ShowOnTrustCenter *bool
|
TrustCenterVisibility *coredata.TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateAuditStateRequest struct {
|
UpdateAuditStateRequest struct {
|
||||||
@@ -113,22 +114,26 @@ func (s *AuditService) Create(
|
|||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|
||||||
audit := &coredata.Audit{
|
audit := &coredata.Audit{
|
||||||
ID: gid.New(s.svc.scope.GetTenantID(), coredata.AuditEntityType),
|
ID: gid.New(s.svc.scope.GetTenantID(), coredata.AuditEntityType),
|
||||||
Name: req.Name,
|
Name: req.Name,
|
||||||
OrganizationID: req.OrganizationID,
|
OrganizationID: req.OrganizationID,
|
||||||
FrameworkID: req.FrameworkID,
|
FrameworkID: req.FrameworkID,
|
||||||
ValidFrom: req.ValidFrom,
|
ValidFrom: req.ValidFrom,
|
||||||
ValidUntil: req.ValidUntil,
|
ValidUntil: req.ValidUntil,
|
||||||
State: coredata.AuditStateNotStarted,
|
State: coredata.AuditStateNotStarted,
|
||||||
ShowOnTrustCenter: false,
|
TrustCenterVisibility: coredata.TrustCenterVisibilityNone,
|
||||||
CreatedAt: now,
|
CreatedAt: now,
|
||||||
UpdatedAt: now,
|
UpdatedAt: now,
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.State != nil {
|
if req.State != nil {
|
||||||
audit.State = *req.State
|
audit.State = *req.State
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.TrustCenterVisibility != nil {
|
||||||
|
audit.TrustCenterVisibility = *req.TrustCenterVisibility
|
||||||
|
}
|
||||||
|
|
||||||
err := s.svc.pg.WithTx(
|
err := s.svc.pg.WithTx(
|
||||||
ctx,
|
ctx,
|
||||||
func(conn pg.Conn) error {
|
func(conn pg.Conn) error {
|
||||||
@@ -182,8 +187,8 @@ func (s *AuditService) Update(
|
|||||||
if req.State != nil {
|
if req.State != nil {
|
||||||
audit.State = *req.State
|
audit.State = *req.State
|
||||||
}
|
}
|
||||||
if req.ShowOnTrustCenter != nil {
|
if req.TrustCenterVisibility != nil {
|
||||||
audit.ShowOnTrustCenter = *req.ShowOnTrustCenter
|
audit.TrustCenterVisibility = *req.TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
audit.UpdatedAt = time.Now()
|
audit.UpdatedAt = time.Now()
|
||||||
|
|||||||
@@ -40,11 +40,12 @@ type (
|
|||||||
}
|
}
|
||||||
|
|
||||||
CreateDocumentRequest struct {
|
CreateDocumentRequest struct {
|
||||||
OrganizationID gid.GID
|
OrganizationID gid.GID
|
||||||
Title string
|
Title string
|
||||||
Content string
|
Content string
|
||||||
OwnerID gid.GID
|
OwnerID gid.GID
|
||||||
DocumentType coredata.DocumentType
|
DocumentType coredata.DocumentType
|
||||||
|
TrustCenterVisibility *coredata.TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateDocumentVersionRequest struct {
|
UpdateDocumentVersionRequest struct {
|
||||||
@@ -310,12 +311,16 @@ func (s *DocumentService) Create(
|
|||||||
people := &coredata.People{}
|
people := &coredata.People{}
|
||||||
|
|
||||||
document := &coredata.Document{
|
document := &coredata.Document{
|
||||||
ID: documentID,
|
ID: documentID,
|
||||||
Title: req.Title,
|
Title: req.Title,
|
||||||
DocumentType: req.DocumentType,
|
DocumentType: req.DocumentType,
|
||||||
ShowOnTrustCenter: false,
|
TrustCenterVisibility: coredata.TrustCenterVisibilityNone,
|
||||||
CreatedAt: now,
|
CreatedAt: now,
|
||||||
UpdatedAt: now,
|
UpdatedAt: now,
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.TrustCenterVisibility != nil {
|
||||||
|
document.TrustCenterVisibility = *req.TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
documentVersion := &coredata.DocumentVersion{
|
documentVersion := &coredata.DocumentVersion{
|
||||||
@@ -1096,7 +1101,7 @@ func (s *DocumentService) Update(
|
|||||||
newOwnerID *gid.GID,
|
newOwnerID *gid.GID,
|
||||||
documentType *coredata.DocumentType,
|
documentType *coredata.DocumentType,
|
||||||
title *string,
|
title *string,
|
||||||
showOnTrustCenter *bool,
|
trustCenterVisibility *coredata.TrustCenterVisibility,
|
||||||
) (*coredata.Document, error) {
|
) (*coredata.Document, error) {
|
||||||
document := &coredata.Document{}
|
document := &coredata.Document{}
|
||||||
people := &coredata.People{}
|
people := &coredata.People{}
|
||||||
@@ -1124,8 +1129,8 @@ func (s *DocumentService) Update(
|
|||||||
document.Title = *title
|
document.Title = *title
|
||||||
}
|
}
|
||||||
|
|
||||||
if showOnTrustCenter != nil {
|
if trustCenterVisibility != nil {
|
||||||
document.ShowOnTrustCenter = *showOnTrustCenter
|
document.TrustCenterVisibility = *trustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
document.UpdatedAt = now
|
document.UpdatedAt = now
|
||||||
|
|||||||
@@ -152,6 +152,22 @@ enum AuditState
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum TrustCenterVisibility
|
||||||
|
@goModel(model: "github.com/getprobo/probo/pkg/coredata.TrustCenterVisibility") {
|
||||||
|
NONE
|
||||||
|
@goEnum(
|
||||||
|
value: "github.com/getprobo/probo/pkg/coredata.TrustCenterVisibilityNone"
|
||||||
|
)
|
||||||
|
PRIVATE
|
||||||
|
@goEnum(
|
||||||
|
value: "github.com/getprobo/probo/pkg/coredata.TrustCenterVisibilityPrivate"
|
||||||
|
)
|
||||||
|
PUBLIC
|
||||||
|
@goEnum(
|
||||||
|
value: "github.com/getprobo/probo/pkg/coredata.TrustCenterVisibilityPublic"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
enum NonconformityStatus
|
enum NonconformityStatus
|
||||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.NonconformityStatus") {
|
@goModel(model: "github.com/getprobo/probo/pkg/coredata.NonconformityStatus") {
|
||||||
OPEN
|
OPEN
|
||||||
@@ -1950,7 +1966,7 @@ type Document implements Node {
|
|||||||
description: String!
|
description: String!
|
||||||
documentType: DocumentType!
|
documentType: DocumentType!
|
||||||
currentPublishedVersion: Int
|
currentPublishedVersion: Int
|
||||||
showOnTrustCenter: Boolean!
|
trustCenterVisibility: TrustCenterVisibility!
|
||||||
owner: People! @goField(forceResolver: true)
|
owner: People! @goField(forceResolver: true)
|
||||||
organization: Organization! @goField(forceResolver: true)
|
organization: Organization! @goField(forceResolver: true)
|
||||||
|
|
||||||
@@ -2054,7 +2070,7 @@ type Audit implements Node {
|
|||||||
filter: ControlFilter
|
filter: ControlFilter
|
||||||
): ControlConnection! @goField(forceResolver: true)
|
): ControlConnection! @goField(forceResolver: true)
|
||||||
|
|
||||||
showOnTrustCenter: Boolean!
|
trustCenterVisibility: TrustCenterVisibility!
|
||||||
createdAt: Datetime!
|
createdAt: Datetime!
|
||||||
updatedAt: Datetime!
|
updatedAt: Datetime!
|
||||||
}
|
}
|
||||||
@@ -3345,6 +3361,7 @@ input CreateDocumentInput {
|
|||||||
content: String!
|
content: String!
|
||||||
ownerId: ID!
|
ownerId: ID!
|
||||||
documentType: DocumentType!
|
documentType: DocumentType!
|
||||||
|
trustCenterVisibility: TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
input UpdateDocumentInput {
|
input UpdateDocumentInput {
|
||||||
@@ -3353,7 +3370,7 @@ input UpdateDocumentInput {
|
|||||||
content: String
|
content: String
|
||||||
ownerId: ID
|
ownerId: ID
|
||||||
documentType: DocumentType
|
documentType: DocumentType
|
||||||
showOnTrustCenter: Boolean
|
trustCenterVisibility: TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
input ExportDocumentVersionPDFInput {
|
input ExportDocumentVersionPDFInput {
|
||||||
@@ -3413,6 +3430,7 @@ input CreateAuditInput {
|
|||||||
validFrom: Datetime
|
validFrom: Datetime
|
||||||
validUntil: Datetime
|
validUntil: Datetime
|
||||||
state: AuditState
|
state: AuditState
|
||||||
|
trustCenterVisibility: TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
input UpdateAuditInput {
|
input UpdateAuditInput {
|
||||||
@@ -3421,7 +3439,7 @@ input UpdateAuditInput {
|
|||||||
validFrom: Datetime
|
validFrom: Datetime
|
||||||
validUntil: Datetime
|
validUntil: Datetime
|
||||||
state: AuditState
|
state: AuditState
|
||||||
showOnTrustCenter: Boolean
|
trustCenterVisibility: TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
input DeleteAuditInput {
|
input DeleteAuditInput {
|
||||||
|
|||||||
@@ -139,19 +139,19 @@ type ComplexityRoot struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Audit struct {
|
Audit struct {
|
||||||
Controls func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy, filter *types.ControlFilter) int
|
Controls func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy, filter *types.ControlFilter) int
|
||||||
CreatedAt func(childComplexity int) int
|
CreatedAt func(childComplexity int) int
|
||||||
Framework func(childComplexity int) int
|
Framework func(childComplexity int) int
|
||||||
ID func(childComplexity int) int
|
ID func(childComplexity int) int
|
||||||
Name func(childComplexity int) int
|
Name func(childComplexity int) int
|
||||||
Organization func(childComplexity int) int
|
Organization func(childComplexity int) int
|
||||||
Report func(childComplexity int) int
|
Report func(childComplexity int) int
|
||||||
ReportURL func(childComplexity int) int
|
ReportURL func(childComplexity int) int
|
||||||
ShowOnTrustCenter func(childComplexity int) int
|
State func(childComplexity int) int
|
||||||
State func(childComplexity int) int
|
TrustCenterVisibility func(childComplexity int) int
|
||||||
UpdatedAt func(childComplexity int) int
|
UpdatedAt func(childComplexity int) int
|
||||||
ValidFrom func(childComplexity int) int
|
ValidFrom func(childComplexity int) int
|
||||||
ValidUntil func(childComplexity int) int
|
ValidUntil func(childComplexity int) int
|
||||||
}
|
}
|
||||||
|
|
||||||
AuditConnection struct {
|
AuditConnection struct {
|
||||||
@@ -573,8 +573,8 @@ type ComplexityRoot struct {
|
|||||||
ID func(childComplexity int) int
|
ID func(childComplexity int) int
|
||||||
Organization func(childComplexity int) int
|
Organization func(childComplexity int) int
|
||||||
Owner func(childComplexity int) int
|
Owner func(childComplexity int) int
|
||||||
ShowOnTrustCenter func(childComplexity int) int
|
|
||||||
Title func(childComplexity int) int
|
Title func(childComplexity int) int
|
||||||
|
TrustCenterVisibility func(childComplexity int) int
|
||||||
UpdatedAt func(childComplexity int) int
|
UpdatedAt func(childComplexity int) int
|
||||||
Versions func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentVersionOrderBy, filter *types.DocumentVersionFilter) int
|
Versions func(childComplexity int, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.DocumentVersionOrderBy, filter *types.DocumentVersionFilter) int
|
||||||
}
|
}
|
||||||
@@ -2132,13 +2132,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
|
|
||||||
return e.complexity.Audit.ReportURL(childComplexity), true
|
return e.complexity.Audit.ReportURL(childComplexity), true
|
||||||
|
|
||||||
case "Audit.showOnTrustCenter":
|
|
||||||
if e.complexity.Audit.ShowOnTrustCenter == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
return e.complexity.Audit.ShowOnTrustCenter(childComplexity), true
|
|
||||||
|
|
||||||
case "Audit.state":
|
case "Audit.state":
|
||||||
if e.complexity.Audit.State == nil {
|
if e.complexity.Audit.State == nil {
|
||||||
break
|
break
|
||||||
@@ -2146,6 +2139,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
|
|
||||||
return e.complexity.Audit.State(childComplexity), true
|
return e.complexity.Audit.State(childComplexity), true
|
||||||
|
|
||||||
|
case "Audit.trustCenterVisibility":
|
||||||
|
if e.complexity.Audit.TrustCenterVisibility == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Audit.TrustCenterVisibility(childComplexity), true
|
||||||
|
|
||||||
case "Audit.updatedAt":
|
case "Audit.updatedAt":
|
||||||
if e.complexity.Audit.UpdatedAt == nil {
|
if e.complexity.Audit.UpdatedAt == nil {
|
||||||
break
|
break
|
||||||
@@ -3317,13 +3317,6 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
|
|
||||||
return e.complexity.Document.Owner(childComplexity), true
|
return e.complexity.Document.Owner(childComplexity), true
|
||||||
|
|
||||||
case "Document.showOnTrustCenter":
|
|
||||||
if e.complexity.Document.ShowOnTrustCenter == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
return e.complexity.Document.ShowOnTrustCenter(childComplexity), true
|
|
||||||
|
|
||||||
case "Document.title":
|
case "Document.title":
|
||||||
if e.complexity.Document.Title == nil {
|
if e.complexity.Document.Title == nil {
|
||||||
break
|
break
|
||||||
@@ -3331,6 +3324,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin
|
|||||||
|
|
||||||
return e.complexity.Document.Title(childComplexity), true
|
return e.complexity.Document.Title(childComplexity), true
|
||||||
|
|
||||||
|
case "Document.trustCenterVisibility":
|
||||||
|
if e.complexity.Document.TrustCenterVisibility == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
return e.complexity.Document.TrustCenterVisibility(childComplexity), true
|
||||||
|
|
||||||
case "Document.updatedAt":
|
case "Document.updatedAt":
|
||||||
if e.complexity.Document.UpdatedAt == nil {
|
if e.complexity.Document.UpdatedAt == nil {
|
||||||
break
|
break
|
||||||
@@ -8705,6 +8705,22 @@ enum AuditState
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum TrustCenterVisibility
|
||||||
|
@goModel(model: "github.com/getprobo/probo/pkg/coredata.TrustCenterVisibility") {
|
||||||
|
NONE
|
||||||
|
@goEnum(
|
||||||
|
value: "github.com/getprobo/probo/pkg/coredata.TrustCenterVisibilityNone"
|
||||||
|
)
|
||||||
|
PRIVATE
|
||||||
|
@goEnum(
|
||||||
|
value: "github.com/getprobo/probo/pkg/coredata.TrustCenterVisibilityPrivate"
|
||||||
|
)
|
||||||
|
PUBLIC
|
||||||
|
@goEnum(
|
||||||
|
value: "github.com/getprobo/probo/pkg/coredata.TrustCenterVisibilityPublic"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
enum NonconformityStatus
|
enum NonconformityStatus
|
||||||
@goModel(model: "github.com/getprobo/probo/pkg/coredata.NonconformityStatus") {
|
@goModel(model: "github.com/getprobo/probo/pkg/coredata.NonconformityStatus") {
|
||||||
OPEN
|
OPEN
|
||||||
@@ -10503,7 +10519,7 @@ type Document implements Node {
|
|||||||
description: String!
|
description: String!
|
||||||
documentType: DocumentType!
|
documentType: DocumentType!
|
||||||
currentPublishedVersion: Int
|
currentPublishedVersion: Int
|
||||||
showOnTrustCenter: Boolean!
|
trustCenterVisibility: TrustCenterVisibility!
|
||||||
owner: People! @goField(forceResolver: true)
|
owner: People! @goField(forceResolver: true)
|
||||||
organization: Organization! @goField(forceResolver: true)
|
organization: Organization! @goField(forceResolver: true)
|
||||||
|
|
||||||
@@ -10607,7 +10623,7 @@ type Audit implements Node {
|
|||||||
filter: ControlFilter
|
filter: ControlFilter
|
||||||
): ControlConnection! @goField(forceResolver: true)
|
): ControlConnection! @goField(forceResolver: true)
|
||||||
|
|
||||||
showOnTrustCenter: Boolean!
|
trustCenterVisibility: TrustCenterVisibility!
|
||||||
createdAt: Datetime!
|
createdAt: Datetime!
|
||||||
updatedAt: Datetime!
|
updatedAt: Datetime!
|
||||||
}
|
}
|
||||||
@@ -11898,6 +11914,7 @@ input CreateDocumentInput {
|
|||||||
content: String!
|
content: String!
|
||||||
ownerId: ID!
|
ownerId: ID!
|
||||||
documentType: DocumentType!
|
documentType: DocumentType!
|
||||||
|
trustCenterVisibility: TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
input UpdateDocumentInput {
|
input UpdateDocumentInput {
|
||||||
@@ -11906,7 +11923,7 @@ input UpdateDocumentInput {
|
|||||||
content: String
|
content: String
|
||||||
ownerId: ID
|
ownerId: ID
|
||||||
documentType: DocumentType
|
documentType: DocumentType
|
||||||
showOnTrustCenter: Boolean
|
trustCenterVisibility: TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
input ExportDocumentVersionPDFInput {
|
input ExportDocumentVersionPDFInput {
|
||||||
@@ -11966,6 +11983,7 @@ input CreateAuditInput {
|
|||||||
validFrom: Datetime
|
validFrom: Datetime
|
||||||
validUntil: Datetime
|
validUntil: Datetime
|
||||||
state: AuditState
|
state: AuditState
|
||||||
|
trustCenterVisibility: TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
input UpdateAuditInput {
|
input UpdateAuditInput {
|
||||||
@@ -11974,7 +11992,7 @@ input UpdateAuditInput {
|
|||||||
validFrom: Datetime
|
validFrom: Datetime
|
||||||
validUntil: Datetime
|
validUntil: Datetime
|
||||||
state: AuditState
|
state: AuditState
|
||||||
showOnTrustCenter: Boolean
|
trustCenterVisibility: TrustCenterVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
input DeleteAuditInput {
|
input DeleteAuditInput {
|
||||||
@@ -22353,8 +22371,8 @@ func (ec *executionContext) fieldContext_Audit_controls(ctx context.Context, fie
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Audit_showOnTrustCenter(ctx context.Context, field graphql.CollectedField, obj *types.Audit) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Audit_trustCenterVisibility(ctx context.Context, field graphql.CollectedField, obj *types.Audit) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Audit_showOnTrustCenter(ctx, field)
|
fc, err := ec.fieldContext_Audit_trustCenterVisibility(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return graphql.Null
|
return graphql.Null
|
||||||
}
|
}
|
||||||
@@ -22367,7 +22385,7 @@ func (ec *executionContext) _Audit_showOnTrustCenter(ctx context.Context, field
|
|||||||
}()
|
}()
|
||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return obj.ShowOnTrustCenter, nil
|
return obj.TrustCenterVisibility, nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ec.Error(ctx, err)
|
ec.Error(ctx, err)
|
||||||
@@ -22379,19 +22397,19 @@ func (ec *executionContext) _Audit_showOnTrustCenter(ctx context.Context, field
|
|||||||
}
|
}
|
||||||
return graphql.Null
|
return graphql.Null
|
||||||
}
|
}
|
||||||
res := resTmp.(bool)
|
res := resTmp.(coredata.TrustCenterVisibility)
|
||||||
fc.Result = res
|
fc.Result = res
|
||||||
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
|
return ec.marshalNTrustCenterVisibility2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility(ctx, field.Selections, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) fieldContext_Audit_showOnTrustCenter(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
func (ec *executionContext) fieldContext_Audit_trustCenterVisibility(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
fc = &graphql.FieldContext{
|
fc = &graphql.FieldContext{
|
||||||
Object: "Audit",
|
Object: "Audit",
|
||||||
Field: field,
|
Field: field,
|
||||||
IsMethod: false,
|
IsMethod: false,
|
||||||
IsResolver: false,
|
IsResolver: false,
|
||||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
return nil, errors.New("field of type Boolean does not have child fields")
|
return nil, errors.New("field of type TrustCenterVisibility does not have child fields")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return fc, nil
|
return fc, nil
|
||||||
@@ -22736,8 +22754,8 @@ func (ec *executionContext) fieldContext_AuditEdge_node(_ context.Context, field
|
|||||||
return ec.fieldContext_Audit_state(ctx, field)
|
return ec.fieldContext_Audit_state(ctx, field)
|
||||||
case "controls":
|
case "controls":
|
||||||
return ec.fieldContext_Audit_controls(ctx, field)
|
return ec.fieldContext_Audit_controls(ctx, field)
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
return ec.fieldContext_Audit_showOnTrustCenter(ctx, field)
|
return ec.fieldContext_Audit_trustCenterVisibility(ctx, field)
|
||||||
case "createdAt":
|
case "createdAt":
|
||||||
return ec.fieldContext_Audit_createdAt(ctx, field)
|
return ec.fieldContext_Audit_createdAt(ctx, field)
|
||||||
case "updatedAt":
|
case "updatedAt":
|
||||||
@@ -28170,8 +28188,8 @@ func (ec *executionContext) fieldContext_DeleteAuditReportPayload_audit(_ contex
|
|||||||
return ec.fieldContext_Audit_state(ctx, field)
|
return ec.fieldContext_Audit_state(ctx, field)
|
||||||
case "controls":
|
case "controls":
|
||||||
return ec.fieldContext_Audit_controls(ctx, field)
|
return ec.fieldContext_Audit_controls(ctx, field)
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
return ec.fieldContext_Audit_showOnTrustCenter(ctx, field)
|
return ec.fieldContext_Audit_trustCenterVisibility(ctx, field)
|
||||||
case "createdAt":
|
case "createdAt":
|
||||||
return ec.fieldContext_Audit_createdAt(ctx, field)
|
return ec.fieldContext_Audit_createdAt(ctx, field)
|
||||||
case "updatedAt":
|
case "updatedAt":
|
||||||
@@ -30138,8 +30156,8 @@ func (ec *executionContext) fieldContext_Document_currentPublishedVersion(_ cont
|
|||||||
return fc, nil
|
return fc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _Document_showOnTrustCenter(ctx context.Context, field graphql.CollectedField, obj *types.Document) (ret graphql.Marshaler) {
|
func (ec *executionContext) _Document_trustCenterVisibility(ctx context.Context, field graphql.CollectedField, obj *types.Document) (ret graphql.Marshaler) {
|
||||||
fc, err := ec.fieldContext_Document_showOnTrustCenter(ctx, field)
|
fc, err := ec.fieldContext_Document_trustCenterVisibility(ctx, field)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return graphql.Null
|
return graphql.Null
|
||||||
}
|
}
|
||||||
@@ -30152,7 +30170,7 @@ func (ec *executionContext) _Document_showOnTrustCenter(ctx context.Context, fie
|
|||||||
}()
|
}()
|
||||||
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (any, error) {
|
||||||
ctx = rctx // use context from middleware stack in children
|
ctx = rctx // use context from middleware stack in children
|
||||||
return obj.ShowOnTrustCenter, nil
|
return obj.TrustCenterVisibility, nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ec.Error(ctx, err)
|
ec.Error(ctx, err)
|
||||||
@@ -30164,19 +30182,19 @@ func (ec *executionContext) _Document_showOnTrustCenter(ctx context.Context, fie
|
|||||||
}
|
}
|
||||||
return graphql.Null
|
return graphql.Null
|
||||||
}
|
}
|
||||||
res := resTmp.(bool)
|
res := resTmp.(coredata.TrustCenterVisibility)
|
||||||
fc.Result = res
|
fc.Result = res
|
||||||
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
|
return ec.marshalNTrustCenterVisibility2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility(ctx, field.Selections, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) fieldContext_Document_showOnTrustCenter(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
func (ec *executionContext) fieldContext_Document_trustCenterVisibility(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
|
||||||
fc = &graphql.FieldContext{
|
fc = &graphql.FieldContext{
|
||||||
Object: "Document",
|
Object: "Document",
|
||||||
Field: field,
|
Field: field,
|
||||||
IsMethod: false,
|
IsMethod: false,
|
||||||
IsResolver: false,
|
IsResolver: false,
|
||||||
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
|
||||||
return nil, errors.New("field of type Boolean does not have child fields")
|
return nil, errors.New("field of type TrustCenterVisibility does not have child fields")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return fc, nil
|
return fc, nil
|
||||||
@@ -30803,8 +30821,8 @@ func (ec *executionContext) fieldContext_DocumentEdge_node(_ context.Context, fi
|
|||||||
return ec.fieldContext_Document_documentType(ctx, field)
|
return ec.fieldContext_Document_documentType(ctx, field)
|
||||||
case "currentPublishedVersion":
|
case "currentPublishedVersion":
|
||||||
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
|
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
return ec.fieldContext_Document_showOnTrustCenter(ctx, field)
|
return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
|
||||||
case "owner":
|
case "owner":
|
||||||
return ec.fieldContext_Document_owner(ctx, field)
|
return ec.fieldContext_Document_owner(ctx, field)
|
||||||
case "organization":
|
case "organization":
|
||||||
@@ -30917,8 +30935,8 @@ func (ec *executionContext) fieldContext_DocumentVersion_document(_ context.Cont
|
|||||||
return ec.fieldContext_Document_documentType(ctx, field)
|
return ec.fieldContext_Document_documentType(ctx, field)
|
||||||
case "currentPublishedVersion":
|
case "currentPublishedVersion":
|
||||||
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
|
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
return ec.fieldContext_Document_showOnTrustCenter(ctx, field)
|
return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
|
||||||
case "owner":
|
case "owner":
|
||||||
return ec.fieldContext_Document_owner(ctx, field)
|
return ec.fieldContext_Document_owner(ctx, field)
|
||||||
case "organization":
|
case "organization":
|
||||||
@@ -42270,8 +42288,8 @@ func (ec *executionContext) fieldContext_Nonconformity_audit(_ context.Context,
|
|||||||
return ec.fieldContext_Audit_state(ctx, field)
|
return ec.fieldContext_Audit_state(ctx, field)
|
||||||
case "controls":
|
case "controls":
|
||||||
return ec.fieldContext_Audit_controls(ctx, field)
|
return ec.fieldContext_Audit_controls(ctx, field)
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
return ec.fieldContext_Audit_showOnTrustCenter(ctx, field)
|
return ec.fieldContext_Audit_trustCenterVisibility(ctx, field)
|
||||||
case "createdAt":
|
case "createdAt":
|
||||||
return ec.fieldContext_Audit_createdAt(ctx, field)
|
return ec.fieldContext_Audit_createdAt(ctx, field)
|
||||||
case "updatedAt":
|
case "updatedAt":
|
||||||
@@ -47969,8 +47987,8 @@ func (ec *executionContext) fieldContext_PublishDocumentVersionPayload_document(
|
|||||||
return ec.fieldContext_Document_documentType(ctx, field)
|
return ec.fieldContext_Document_documentType(ctx, field)
|
||||||
case "currentPublishedVersion":
|
case "currentPublishedVersion":
|
||||||
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
|
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
return ec.fieldContext_Document_showOnTrustCenter(ctx, field)
|
return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
|
||||||
case "owner":
|
case "owner":
|
||||||
return ec.fieldContext_Document_owner(ctx, field)
|
return ec.fieldContext_Document_owner(ctx, field)
|
||||||
case "organization":
|
case "organization":
|
||||||
@@ -48677,8 +48695,8 @@ func (ec *executionContext) fieldContext_Report_audit(_ context.Context, field g
|
|||||||
return ec.fieldContext_Audit_state(ctx, field)
|
return ec.fieldContext_Audit_state(ctx, field)
|
||||||
case "controls":
|
case "controls":
|
||||||
return ec.fieldContext_Audit_controls(ctx, field)
|
return ec.fieldContext_Audit_controls(ctx, field)
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
return ec.fieldContext_Audit_showOnTrustCenter(ctx, field)
|
return ec.fieldContext_Audit_trustCenterVisibility(ctx, field)
|
||||||
case "createdAt":
|
case "createdAt":
|
||||||
return ec.fieldContext_Audit_createdAt(ctx, field)
|
return ec.fieldContext_Audit_createdAt(ctx, field)
|
||||||
case "updatedAt":
|
case "updatedAt":
|
||||||
@@ -53308,8 +53326,8 @@ func (ec *executionContext) fieldContext_TrustCenterDocumentAccess_document(_ co
|
|||||||
return ec.fieldContext_Document_documentType(ctx, field)
|
return ec.fieldContext_Document_documentType(ctx, field)
|
||||||
case "currentPublishedVersion":
|
case "currentPublishedVersion":
|
||||||
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
|
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
return ec.fieldContext_Document_showOnTrustCenter(ctx, field)
|
return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
|
||||||
case "owner":
|
case "owner":
|
||||||
return ec.fieldContext_Document_owner(ctx, field)
|
return ec.fieldContext_Document_owner(ctx, field)
|
||||||
case "organization":
|
case "organization":
|
||||||
@@ -54511,8 +54529,8 @@ func (ec *executionContext) fieldContext_UpdateAuditPayload_audit(_ context.Cont
|
|||||||
return ec.fieldContext_Audit_state(ctx, field)
|
return ec.fieldContext_Audit_state(ctx, field)
|
||||||
case "controls":
|
case "controls":
|
||||||
return ec.fieldContext_Audit_controls(ctx, field)
|
return ec.fieldContext_Audit_controls(ctx, field)
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
return ec.fieldContext_Audit_showOnTrustCenter(ctx, field)
|
return ec.fieldContext_Audit_trustCenterVisibility(ctx, field)
|
||||||
case "createdAt":
|
case "createdAt":
|
||||||
return ec.fieldContext_Audit_createdAt(ctx, field)
|
return ec.fieldContext_Audit_createdAt(ctx, field)
|
||||||
case "updatedAt":
|
case "updatedAt":
|
||||||
@@ -54781,8 +54799,8 @@ func (ec *executionContext) fieldContext_UpdateDocumentPayload_document(_ contex
|
|||||||
return ec.fieldContext_Document_documentType(ctx, field)
|
return ec.fieldContext_Document_documentType(ctx, field)
|
||||||
case "currentPublishedVersion":
|
case "currentPublishedVersion":
|
||||||
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
|
return ec.fieldContext_Document_currentPublishedVersion(ctx, field)
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
return ec.fieldContext_Document_showOnTrustCenter(ctx, field)
|
return ec.fieldContext_Document_trustCenterVisibility(ctx, field)
|
||||||
case "owner":
|
case "owner":
|
||||||
return ec.fieldContext_Document_owner(ctx, field)
|
return ec.fieldContext_Document_owner(ctx, field)
|
||||||
case "organization":
|
case "organization":
|
||||||
@@ -56169,8 +56187,8 @@ func (ec *executionContext) fieldContext_UploadAuditReportPayload_audit(_ contex
|
|||||||
return ec.fieldContext_Audit_state(ctx, field)
|
return ec.fieldContext_Audit_state(ctx, field)
|
||||||
case "controls":
|
case "controls":
|
||||||
return ec.fieldContext_Audit_controls(ctx, field)
|
return ec.fieldContext_Audit_controls(ctx, field)
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
return ec.fieldContext_Audit_showOnTrustCenter(ctx, field)
|
return ec.fieldContext_Audit_trustCenterVisibility(ctx, field)
|
||||||
case "createdAt":
|
case "createdAt":
|
||||||
return ec.fieldContext_Audit_createdAt(ctx, field)
|
return ec.fieldContext_Audit_createdAt(ctx, field)
|
||||||
case "updatedAt":
|
case "updatedAt":
|
||||||
@@ -64908,7 +64926,7 @@ func (ec *executionContext) unmarshalInputCreateAuditInput(ctx context.Context,
|
|||||||
asMap[k] = v
|
asMap[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsInOrder := [...]string{"organizationId", "frameworkId", "name", "validFrom", "validUntil", "state"}
|
fieldsInOrder := [...]string{"organizationId", "frameworkId", "name", "validFrom", "validUntil", "state", "trustCenterVisibility"}
|
||||||
for _, k := range fieldsInOrder {
|
for _, k := range fieldsInOrder {
|
||||||
v, ok := asMap[k]
|
v, ok := asMap[k]
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -64957,6 +64975,13 @@ func (ec *executionContext) unmarshalInputCreateAuditInput(ctx context.Context,
|
|||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
it.State = data
|
it.State = data
|
||||||
|
case "trustCenterVisibility":
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trustCenterVisibility"))
|
||||||
|
data, err := ec.unmarshalOTrustCenterVisibility2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility(ctx, v)
|
||||||
|
if err != nil {
|
||||||
|
return it, err
|
||||||
|
}
|
||||||
|
it.TrustCenterVisibility = data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65299,7 +65324,7 @@ func (ec *executionContext) unmarshalInputCreateDocumentInput(ctx context.Contex
|
|||||||
asMap[k] = v
|
asMap[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsInOrder := [...]string{"organizationId", "title", "content", "ownerId", "documentType"}
|
fieldsInOrder := [...]string{"organizationId", "title", "content", "ownerId", "documentType", "trustCenterVisibility"}
|
||||||
for _, k := range fieldsInOrder {
|
for _, k := range fieldsInOrder {
|
||||||
v, ok := asMap[k]
|
v, ok := asMap[k]
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -65341,6 +65366,13 @@ func (ec *executionContext) unmarshalInputCreateDocumentInput(ctx context.Contex
|
|||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
it.DocumentType = data
|
it.DocumentType = data
|
||||||
|
case "trustCenterVisibility":
|
||||||
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trustCenterVisibility"))
|
||||||
|
data, err := ec.unmarshalOTrustCenterVisibility2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility(ctx, v)
|
||||||
|
if err != nil {
|
||||||
|
return it, err
|
||||||
|
}
|
||||||
|
it.TrustCenterVisibility = data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69154,7 +69186,7 @@ func (ec *executionContext) unmarshalInputUpdateAuditInput(ctx context.Context,
|
|||||||
asMap[k] = v
|
asMap[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsInOrder := [...]string{"id", "name", "validFrom", "validUntil", "state", "showOnTrustCenter"}
|
fieldsInOrder := [...]string{"id", "name", "validFrom", "validUntil", "state", "trustCenterVisibility"}
|
||||||
for _, k := range fieldsInOrder {
|
for _, k := range fieldsInOrder {
|
||||||
v, ok := asMap[k]
|
v, ok := asMap[k]
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -69196,13 +69228,13 @@ func (ec *executionContext) unmarshalInputUpdateAuditInput(ctx context.Context,
|
|||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
it.State = data
|
it.State = data
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("showOnTrustCenter"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trustCenterVisibility"))
|
||||||
data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v)
|
data, err := ec.unmarshalOTrustCenterVisibility2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility(ctx, v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
it.ShowOnTrustCenter = data
|
it.TrustCenterVisibility = data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69409,7 +69441,7 @@ func (ec *executionContext) unmarshalInputUpdateDocumentInput(ctx context.Contex
|
|||||||
asMap[k] = v
|
asMap[k] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldsInOrder := [...]string{"id", "title", "content", "ownerId", "documentType", "showOnTrustCenter"}
|
fieldsInOrder := [...]string{"id", "title", "content", "ownerId", "documentType", "trustCenterVisibility"}
|
||||||
for _, k := range fieldsInOrder {
|
for _, k := range fieldsInOrder {
|
||||||
v, ok := asMap[k]
|
v, ok := asMap[k]
|
||||||
if !ok {
|
if !ok {
|
||||||
@@ -69451,13 +69483,13 @@ func (ec *executionContext) unmarshalInputUpdateDocumentInput(ctx context.Contex
|
|||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
it.DocumentType = data
|
it.DocumentType = data
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("showOnTrustCenter"))
|
ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("trustCenterVisibility"))
|
||||||
data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v)
|
data, err := ec.unmarshalOTrustCenterVisibility2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility(ctx, v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return it, err
|
return it, err
|
||||||
}
|
}
|
||||||
it.ShowOnTrustCenter = data
|
it.TrustCenterVisibility = data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72132,8 +72164,8 @@ func (ec *executionContext) _Audit(ctx context.Context, sel ast.SelectionSet, ob
|
|||||||
}
|
}
|
||||||
|
|
||||||
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
|
out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) })
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
out.Values[i] = ec._Audit_showOnTrustCenter(ctx, field, obj)
|
out.Values[i] = ec._Audit_trustCenterVisibility(ctx, field, obj)
|
||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
atomic.AddUint32(&out.Invalids, 1)
|
atomic.AddUint32(&out.Invalids, 1)
|
||||||
}
|
}
|
||||||
@@ -76300,8 +76332,8 @@ func (ec *executionContext) _Document(ctx context.Context, sel ast.SelectionSet,
|
|||||||
}
|
}
|
||||||
case "currentPublishedVersion":
|
case "currentPublishedVersion":
|
||||||
out.Values[i] = ec._Document_currentPublishedVersion(ctx, field, obj)
|
out.Values[i] = ec._Document_currentPublishedVersion(ctx, field, obj)
|
||||||
case "showOnTrustCenter":
|
case "trustCenterVisibility":
|
||||||
out.Values[i] = ec._Document_showOnTrustCenter(ctx, field, obj)
|
out.Values[i] = ec._Document_trustCenterVisibility(ctx, field, obj)
|
||||||
if out.Values[i] == graphql.Null {
|
if out.Values[i] == graphql.Null {
|
||||||
atomic.AddUint32(&out.Invalids, 1)
|
atomic.AddUint32(&out.Invalids, 1)
|
||||||
}
|
}
|
||||||
@@ -93295,6 +93327,36 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func (ec *executionContext) unmarshalNTrustCenterVisibility2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility(ctx context.Context, v any) (coredata.TrustCenterVisibility, error) {
|
||||||
|
tmp, err := graphql.UnmarshalString(v)
|
||||||
|
res := unmarshalNTrustCenterVisibility2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility[tmp]
|
||||||
|
return res, graphql.ErrorOnPath(ctx, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalNTrustCenterVisibility2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility(ctx context.Context, sel ast.SelectionSet, v coredata.TrustCenterVisibility) graphql.Marshaler {
|
||||||
|
_ = sel
|
||||||
|
res := graphql.MarshalString(marshalNTrustCenterVisibility2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility[v])
|
||||||
|
if res == graphql.Null {
|
||||||
|
if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) {
|
||||||
|
ec.Errorf(ctx, "the requested element is null which the schema does not allow")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
unmarshalNTrustCenterVisibility2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility = map[string]coredata.TrustCenterVisibility{
|
||||||
|
"NONE": coredata.TrustCenterVisibilityNone,
|
||||||
|
"PRIVATE": coredata.TrustCenterVisibilityPrivate,
|
||||||
|
"PUBLIC": coredata.TrustCenterVisibilityPublic,
|
||||||
|
}
|
||||||
|
marshalNTrustCenterVisibility2githubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility = map[coredata.TrustCenterVisibility]string{
|
||||||
|
coredata.TrustCenterVisibilityNone: "NONE",
|
||||||
|
coredata.TrustCenterVisibilityPrivate: "PRIVATE",
|
||||||
|
coredata.TrustCenterVisibilityPublic: "PUBLIC",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalNUnassignTaskInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUnassignTaskInput(ctx context.Context, v any) (types.UnassignTaskInput, error) {
|
func (ec *executionContext) unmarshalNUnassignTaskInput2githubᚗcomᚋgetproboᚋproboᚋpkgᚋserverᚋapiᚋconsoleᚋv1ᚋtypesᚐUnassignTaskInput(ctx context.Context, v any) (types.UnassignTaskInput, error) {
|
||||||
res, err := ec.unmarshalInputUnassignTaskInput(ctx, v)
|
res, err := ec.unmarshalInputUnassignTaskInput(ctx, v)
|
||||||
return res, graphql.ErrorOnPath(ctx, err)
|
return res, graphql.ErrorOnPath(ctx, err)
|
||||||
@@ -96681,6 +96743,38 @@ func (ec *executionContext) unmarshalOTrustCenterReferenceOrder2ᚖgithubᚗcom
|
|||||||
return &res, graphql.ErrorOnPath(ctx, err)
|
return &res, graphql.ErrorOnPath(ctx, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) unmarshalOTrustCenterVisibility2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility(ctx context.Context, v any) (*coredata.TrustCenterVisibility, error) {
|
||||||
|
if v == nil {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
tmp, err := graphql.UnmarshalString(v)
|
||||||
|
res := unmarshalOTrustCenterVisibility2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility[tmp]
|
||||||
|
return &res, graphql.ErrorOnPath(ctx, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ec *executionContext) marshalOTrustCenterVisibility2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility(ctx context.Context, sel ast.SelectionSet, v *coredata.TrustCenterVisibility) graphql.Marshaler {
|
||||||
|
if v == nil {
|
||||||
|
return graphql.Null
|
||||||
|
}
|
||||||
|
_ = sel
|
||||||
|
_ = ctx
|
||||||
|
res := graphql.MarshalString(marshalOTrustCenterVisibility2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility[*v])
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
unmarshalOTrustCenterVisibility2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility = map[string]coredata.TrustCenterVisibility{
|
||||||
|
"NONE": coredata.TrustCenterVisibilityNone,
|
||||||
|
"PRIVATE": coredata.TrustCenterVisibilityPrivate,
|
||||||
|
"PUBLIC": coredata.TrustCenterVisibilityPublic,
|
||||||
|
}
|
||||||
|
marshalOTrustCenterVisibility2ᚖgithubᚗcomᚋgetproboᚋproboᚋpkgᚋcoredataᚐTrustCenterVisibility = map[coredata.TrustCenterVisibility]string{
|
||||||
|
coredata.TrustCenterVisibilityNone: "NONE",
|
||||||
|
coredata.TrustCenterVisibilityPrivate: "PRIVATE",
|
||||||
|
coredata.TrustCenterVisibilityPublic: "PUBLIC",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func (ec *executionContext) unmarshalOUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx context.Context, v any) (*graphql.Upload, error) {
|
func (ec *executionContext) unmarshalOUpload2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋgraphqlᚐUpload(ctx context.Context, v any) (*graphql.Upload, error) {
|
||||||
if v == nil {
|
if v == nil {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|||||||
@@ -54,14 +54,14 @@ func NewAuditConnection(
|
|||||||
|
|
||||||
func NewAudit(a *coredata.Audit) *Audit {
|
func NewAudit(a *coredata.Audit) *Audit {
|
||||||
return &Audit{
|
return &Audit{
|
||||||
ID: a.ID,
|
ID: a.ID,
|
||||||
ValidFrom: a.ValidFrom,
|
ValidFrom: a.ValidFrom,
|
||||||
ValidUntil: a.ValidUntil,
|
ValidUntil: a.ValidUntil,
|
||||||
State: a.State,
|
State: a.State,
|
||||||
Name: a.Name,
|
Name: a.Name,
|
||||||
ShowOnTrustCenter: a.ShowOnTrustCenter,
|
TrustCenterVisibility: a.TrustCenterVisibility,
|
||||||
CreatedAt: a.CreatedAt,
|
CreatedAt: a.CreatedAt,
|
||||||
UpdatedAt: a.UpdatedAt,
|
UpdatedAt: a.UpdatedAt,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ func NewDocument(document *coredata.Document) *Document {
|
|||||||
Title: document.Title,
|
Title: document.Title,
|
||||||
DocumentType: document.DocumentType,
|
DocumentType: document.DocumentType,
|
||||||
CurrentPublishedVersion: document.CurrentPublishedVersion,
|
CurrentPublishedVersion: document.CurrentPublishedVersion,
|
||||||
ShowOnTrustCenter: document.ShowOnTrustCenter,
|
TrustCenterVisibility: document.TrustCenterVisibility,
|
||||||
CreatedAt: document.CreatedAt,
|
CreatedAt: document.CreatedAt,
|
||||||
UpdatedAt: document.UpdatedAt,
|
UpdatedAt: document.UpdatedAt,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,19 +62,19 @@ type AssignTaskPayload struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Audit struct {
|
type Audit struct {
|
||||||
ID gid.GID `json:"id"`
|
ID gid.GID `json:"id"`
|
||||||
Name *string `json:"name,omitempty"`
|
Name *string `json:"name,omitempty"`
|
||||||
Organization *Organization `json:"organization"`
|
Organization *Organization `json:"organization"`
|
||||||
Framework *Framework `json:"framework"`
|
Framework *Framework `json:"framework"`
|
||||||
ValidFrom *time.Time `json:"validFrom,omitempty"`
|
ValidFrom *time.Time `json:"validFrom,omitempty"`
|
||||||
ValidUntil *time.Time `json:"validUntil,omitempty"`
|
ValidUntil *time.Time `json:"validUntil,omitempty"`
|
||||||
Report *Report `json:"report,omitempty"`
|
Report *Report `json:"report,omitempty"`
|
||||||
ReportURL *string `json:"reportUrl,omitempty"`
|
ReportURL *string `json:"reportUrl,omitempty"`
|
||||||
State coredata.AuditState `json:"state"`
|
State coredata.AuditState `json:"state"`
|
||||||
Controls *ControlConnection `json:"controls"`
|
Controls *ControlConnection `json:"controls"`
|
||||||
ShowOnTrustCenter bool `json:"showOnTrustCenter"`
|
TrustCenterVisibility coredata.TrustCenterVisibility `json:"trustCenterVisibility"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
UpdatedAt time.Time `json:"updatedAt"`
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Audit) IsNode() {}
|
func (Audit) IsNode() {}
|
||||||
@@ -237,12 +237,13 @@ type CreateAssetPayload struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreateAuditInput struct {
|
type CreateAuditInput struct {
|
||||||
OrganizationID gid.GID `json:"organizationId"`
|
OrganizationID gid.GID `json:"organizationId"`
|
||||||
FrameworkID gid.GID `json:"frameworkId"`
|
FrameworkID gid.GID `json:"frameworkId"`
|
||||||
Name *string `json:"name,omitempty"`
|
Name *string `json:"name,omitempty"`
|
||||||
ValidFrom *time.Time `json:"validFrom,omitempty"`
|
ValidFrom *time.Time `json:"validFrom,omitempty"`
|
||||||
ValidUntil *time.Time `json:"validUntil,omitempty"`
|
ValidUntil *time.Time `json:"validUntil,omitempty"`
|
||||||
State *coredata.AuditState `json:"state,omitempty"`
|
State *coredata.AuditState `json:"state,omitempty"`
|
||||||
|
TrustCenterVisibility *coredata.TrustCenterVisibility `json:"trustCenterVisibility,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateAuditPayload struct {
|
type CreateAuditPayload struct {
|
||||||
@@ -330,11 +331,12 @@ type CreateDatumPayload struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreateDocumentInput struct {
|
type CreateDocumentInput struct {
|
||||||
OrganizationID gid.GID `json:"organizationId"`
|
OrganizationID gid.GID `json:"organizationId"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
OwnerID gid.GID `json:"ownerId"`
|
OwnerID gid.GID `json:"ownerId"`
|
||||||
DocumentType coredata.DocumentType `json:"documentType"`
|
DocumentType coredata.DocumentType `json:"documentType"`
|
||||||
|
TrustCenterVisibility *coredata.TrustCenterVisibility `json:"trustCenterVisibility,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateDocumentPayload struct {
|
type CreateDocumentPayload struct {
|
||||||
@@ -943,18 +945,18 @@ type DeleteVendorServicePayload struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Document struct {
|
type Document struct {
|
||||||
ID gid.GID `json:"id"`
|
ID gid.GID `json:"id"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
DocumentType coredata.DocumentType `json:"documentType"`
|
DocumentType coredata.DocumentType `json:"documentType"`
|
||||||
CurrentPublishedVersion *int `json:"currentPublishedVersion,omitempty"`
|
CurrentPublishedVersion *int `json:"currentPublishedVersion,omitempty"`
|
||||||
ShowOnTrustCenter bool `json:"showOnTrustCenter"`
|
TrustCenterVisibility coredata.TrustCenterVisibility `json:"trustCenterVisibility"`
|
||||||
Owner *People `json:"owner"`
|
Owner *People `json:"owner"`
|
||||||
Organization *Organization `json:"organization"`
|
Organization *Organization `json:"organization"`
|
||||||
Versions *DocumentVersionConnection `json:"versions"`
|
Versions *DocumentVersionConnection `json:"versions"`
|
||||||
Controls *ControlConnection `json:"controls"`
|
Controls *ControlConnection `json:"controls"`
|
||||||
CreatedAt time.Time `json:"createdAt"`
|
CreatedAt time.Time `json:"createdAt"`
|
||||||
UpdatedAt time.Time `json:"updatedAt"`
|
UpdatedAt time.Time `json:"updatedAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Document) IsNode() {}
|
func (Document) IsNode() {}
|
||||||
@@ -1615,12 +1617,12 @@ type UpdateAssetPayload struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UpdateAuditInput struct {
|
type UpdateAuditInput struct {
|
||||||
ID gid.GID `json:"id"`
|
ID gid.GID `json:"id"`
|
||||||
Name *string `json:"name,omitempty"`
|
Name *string `json:"name,omitempty"`
|
||||||
ValidFrom *time.Time `json:"validFrom,omitempty"`
|
ValidFrom *time.Time `json:"validFrom,omitempty"`
|
||||||
ValidUntil *time.Time `json:"validUntil,omitempty"`
|
ValidUntil *time.Time `json:"validUntil,omitempty"`
|
||||||
State *coredata.AuditState `json:"state,omitempty"`
|
State *coredata.AuditState `json:"state,omitempty"`
|
||||||
ShowOnTrustCenter *bool `json:"showOnTrustCenter,omitempty"`
|
TrustCenterVisibility *coredata.TrustCenterVisibility `json:"trustCenterVisibility,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateAuditPayload struct {
|
type UpdateAuditPayload struct {
|
||||||
@@ -1668,12 +1670,12 @@ type UpdateDatumPayload struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UpdateDocumentInput struct {
|
type UpdateDocumentInput struct {
|
||||||
ID gid.GID `json:"id"`
|
ID gid.GID `json:"id"`
|
||||||
Title *string `json:"title,omitempty"`
|
Title *string `json:"title,omitempty"`
|
||||||
Content *string `json:"content,omitempty"`
|
Content *string `json:"content,omitempty"`
|
||||||
OwnerID *gid.GID `json:"ownerId,omitempty"`
|
OwnerID *gid.GID `json:"ownerId,omitempty"`
|
||||||
DocumentType *coredata.DocumentType `json:"documentType,omitempty"`
|
DocumentType *coredata.DocumentType `json:"documentType,omitempty"`
|
||||||
ShowOnTrustCenter *bool `json:"showOnTrustCenter,omitempty"`
|
TrustCenterVisibility *coredata.TrustCenterVisibility `json:"trustCenterVisibility,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateDocumentPayload struct {
|
type UpdateDocumentPayload struct {
|
||||||
|
|||||||
@@ -2500,11 +2500,12 @@ func (r *mutationResolver) CreateDocument(ctx context.Context, input types.Creat
|
|||||||
document, documentVersion, err := prb.Documents.Create(
|
document, documentVersion, err := prb.Documents.Create(
|
||||||
ctx,
|
ctx,
|
||||||
probo.CreateDocumentRequest{
|
probo.CreateDocumentRequest{
|
||||||
OrganizationID: input.OrganizationID,
|
OrganizationID: input.OrganizationID,
|
||||||
DocumentType: input.DocumentType,
|
DocumentType: input.DocumentType,
|
||||||
Title: input.Title,
|
Title: input.Title,
|
||||||
OwnerID: input.OwnerID,
|
OwnerID: input.OwnerID,
|
||||||
Content: input.Content,
|
Content: input.Content,
|
||||||
|
TrustCenterVisibility: input.TrustCenterVisibility,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -2527,7 +2528,7 @@ func (r *mutationResolver) UpdateDocument(ctx context.Context, input types.Updat
|
|||||||
input.OwnerID,
|
input.OwnerID,
|
||||||
input.DocumentType,
|
input.DocumentType,
|
||||||
input.Title,
|
input.Title,
|
||||||
input.ShowOnTrustCenter,
|
input.TrustCenterVisibility,
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -2963,12 +2964,13 @@ func (r *mutationResolver) CreateAudit(ctx context.Context, input types.CreateAu
|
|||||||
prb := r.ProboService(ctx, input.OrganizationID.TenantID())
|
prb := r.ProboService(ctx, input.OrganizationID.TenantID())
|
||||||
|
|
||||||
req := probo.CreateAuditRequest{
|
req := probo.CreateAuditRequest{
|
||||||
OrganizationID: input.OrganizationID,
|
OrganizationID: input.OrganizationID,
|
||||||
FrameworkID: input.FrameworkID,
|
FrameworkID: input.FrameworkID,
|
||||||
Name: input.Name,
|
Name: input.Name,
|
||||||
ValidFrom: input.ValidFrom,
|
ValidFrom: input.ValidFrom,
|
||||||
ValidUntil: input.ValidUntil,
|
ValidUntil: input.ValidUntil,
|
||||||
State: input.State,
|
State: input.State,
|
||||||
|
TrustCenterVisibility: input.TrustCenterVisibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
audit, err := prb.Audits.Create(ctx, &req)
|
audit, err := prb.Audits.Create(ctx, &req)
|
||||||
@@ -2986,12 +2988,12 @@ func (r *mutationResolver) UpdateAudit(ctx context.Context, input types.UpdateAu
|
|||||||
prb := r.ProboService(ctx, input.ID.TenantID())
|
prb := r.ProboService(ctx, input.ID.TenantID())
|
||||||
|
|
||||||
req := probo.UpdateAuditRequest{
|
req := probo.UpdateAuditRequest{
|
||||||
ID: input.ID,
|
ID: input.ID,
|
||||||
Name: &input.Name,
|
Name: &input.Name,
|
||||||
ValidFrom: input.ValidFrom,
|
ValidFrom: input.ValidFrom,
|
||||||
ValidUntil: input.ValidUntil,
|
ValidUntil: input.ValidUntil,
|
||||||
State: input.State,
|
State: input.State,
|
||||||
ShowOnTrustCenter: input.ShowOnTrustCenter,
|
TrustCenterVisibility: input.TrustCenterVisibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
audit, err := prb.Audits.Update(ctx, &req)
|
audit, err := prb.Audits.Update(ctx, &req)
|
||||||
|
|||||||
@@ -59,6 +59,17 @@ func (r *auditResolver) Report(ctx context.Context, obj *types.Audit) (*types.Re
|
|||||||
|
|
||||||
// IsUserAuthorized is the resolver for the isUserAuthorized field.
|
// IsUserAuthorized is the resolver for the isUserAuthorized field.
|
||||||
func (r *documentResolver) IsUserAuthorized(ctx context.Context, obj *types.Document) (bool, error) {
|
func (r *documentResolver) IsUserAuthorized(ctx context.Context, obj *types.Document) (bool, error) {
|
||||||
|
publicTrustService := r.PublicTrustService(ctx, obj.ID.TenantID())
|
||||||
|
|
||||||
|
document, err := publicTrustService.Documents.Get(ctx, obj.ID)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("cannot load document: %w", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
if document.TrustCenterVisibility == coredata.TrustCenterVisibilityPublic {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
privateTrustService, err := r.PrivateTrustService(ctx, obj.ID.TenantID())
|
privateTrustService, err := r.PrivateTrustService(ctx, obj.ID.TenantID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, nil
|
return false, nil
|
||||||
@@ -153,9 +164,27 @@ func (r *mutationResolver) RequestAllAccesses(ctx context.Context, input types.R
|
|||||||
|
|
||||||
// ExportDocumentPDF is the resolver for the exportDocumentPDF field.
|
// ExportDocumentPDF is the resolver for the exportDocumentPDF field.
|
||||||
func (r *mutationResolver) ExportDocumentPDF(ctx context.Context, input types.ExportDocumentPDFInput) (*types.ExportDocumentPDFPayload, error) {
|
func (r *mutationResolver) ExportDocumentPDF(ctx context.Context, input types.ExportDocumentPDFInput) (*types.ExportDocumentPDFPayload, error) {
|
||||||
|
publicTrustService := r.PublicTrustService(ctx, input.DocumentID.TenantID())
|
||||||
|
|
||||||
|
document, err := publicTrustService.Documents.Get(ctx, input.DocumentID)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("cannot load document: %w", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
if document.TrustCenterVisibility == coredata.TrustCenterVisibilityPublic {
|
||||||
|
pdf, err := publicTrustService.Documents.ExportPDFWithoutWatermark(ctx, input.DocumentID)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("cannot export document PDF: %w", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
return &types.ExportDocumentPDFPayload{
|
||||||
|
Data: fmt.Sprintf("data:application/pdf;base64,%s", base64.StdEncoding.EncodeToString(pdf)),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
privateTrustService, err := r.PrivateTrustService(ctx, input.DocumentID.TenantID())
|
privateTrustService, err := r.PrivateTrustService(ctx, input.DocumentID.TenantID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot export document PDF: %w", err)
|
panic(fmt.Errorf("cannot export document PDF: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
tokenData := TokenAccessFromContext(ctx)
|
tokenData := TokenAccessFromContext(ctx)
|
||||||
@@ -214,6 +243,24 @@ func (r *mutationResolver) ExportDocumentPDF(ctx context.Context, input types.Ex
|
|||||||
|
|
||||||
// ExportReportPDF is the resolver for the exportReportPDF field.
|
// ExportReportPDF is the resolver for the exportReportPDF field.
|
||||||
func (r *mutationResolver) ExportReportPDF(ctx context.Context, input types.ExportReportPDFInput) (*types.ExportReportPDFPayload, error) {
|
func (r *mutationResolver) ExportReportPDF(ctx context.Context, input types.ExportReportPDFInput) (*types.ExportReportPDFPayload, error) {
|
||||||
|
publicTrustService := r.PublicTrustService(ctx, input.ReportID.TenantID())
|
||||||
|
|
||||||
|
audit, err := publicTrustService.Audits.GetByReportID(ctx, input.ReportID)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("cannot load audit: %w", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
if audit.TrustCenterVisibility == coredata.TrustCenterVisibilityPublic {
|
||||||
|
pdf, err := publicTrustService.Reports.ExportPDFWithoutWatermark(ctx, input.ReportID)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("cannot export report PDF: %w", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
return &types.ExportReportPDFPayload{
|
||||||
|
Data: fmt.Sprintf("data:application/pdf;base64,%s", base64.StdEncoding.EncodeToString(pdf)),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
|
||||||
privateTrustService, err := r.PrivateTrustService(ctx, input.ReportID.TenantID())
|
privateTrustService, err := r.PrivateTrustService(ctx, input.ReportID.TenantID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot export report PDF: %w", err)
|
return nil, fmt.Errorf("cannot export report PDF: %w", err)
|
||||||
@@ -296,6 +343,15 @@ func (r *mutationResolver) AcceptNonDisclosureAgreement(ctx context.Context, inp
|
|||||||
func (r *mutationResolver) RequestDocumentAccess(ctx context.Context, input types.RequestDocumentAccessInput) (*types.RequestAccessesPayload, error) {
|
func (r *mutationResolver) RequestDocumentAccess(ctx context.Context, input types.RequestDocumentAccessInput) (*types.RequestAccessesPayload, error) {
|
||||||
publicTrustService := r.PublicTrustService(ctx, input.TrustCenterID.TenantID())
|
publicTrustService := r.PublicTrustService(ctx, input.TrustCenterID.TenantID())
|
||||||
|
|
||||||
|
document, err := publicTrustService.Documents.Get(ctx, input.DocumentID)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("cannot load document: %w", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
if document.TrustCenterVisibility == coredata.TrustCenterVisibilityPublic {
|
||||||
|
return nil, fmt.Errorf("document is publicly available and does not require access request")
|
||||||
|
}
|
||||||
|
|
||||||
userData := r.UserFromContext(ctx)
|
userData := r.UserFromContext(ctx)
|
||||||
if userData != nil {
|
if userData != nil {
|
||||||
return nil, fmt.Errorf("sessions users cannot request trust center access")
|
return nil, fmt.Errorf("sessions users cannot request trust center access")
|
||||||
@@ -340,6 +396,15 @@ func (r *mutationResolver) RequestDocumentAccess(ctx context.Context, input type
|
|||||||
func (r *mutationResolver) RequestReportAccess(ctx context.Context, input types.RequestReportAccessInput) (*types.RequestAccessesPayload, error) {
|
func (r *mutationResolver) RequestReportAccess(ctx context.Context, input types.RequestReportAccessInput) (*types.RequestAccessesPayload, error) {
|
||||||
publicTrustService := r.PublicTrustService(ctx, input.TrustCenterID.TenantID())
|
publicTrustService := r.PublicTrustService(ctx, input.TrustCenterID.TenantID())
|
||||||
|
|
||||||
|
audit, err := publicTrustService.Audits.GetByReportID(ctx, input.ReportID)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("cannot load audit: %w", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
if audit.TrustCenterVisibility == coredata.TrustCenterVisibilityPublic {
|
||||||
|
return nil, fmt.Errorf("report is publicly available and does not require access request")
|
||||||
|
}
|
||||||
|
|
||||||
userData := r.UserFromContext(ctx)
|
userData := r.UserFromContext(ctx)
|
||||||
if userData != nil {
|
if userData != nil {
|
||||||
return nil, fmt.Errorf("session users cannot request trust center access")
|
return nil, fmt.Errorf("session users cannot request trust center access")
|
||||||
@@ -484,6 +549,17 @@ func (r *queryResolver) TrustCenterBySlug(ctx context.Context, slug string) (*ty
|
|||||||
|
|
||||||
// IsUserAuthorized is the resolver for the isUserAuthorized field.
|
// IsUserAuthorized is the resolver for the isUserAuthorized field.
|
||||||
func (r *reportResolver) IsUserAuthorized(ctx context.Context, obj *types.Report) (bool, error) {
|
func (r *reportResolver) IsUserAuthorized(ctx context.Context, obj *types.Report) (bool, error) {
|
||||||
|
publicTrustService := r.PublicTrustService(ctx, obj.ID.TenantID())
|
||||||
|
|
||||||
|
audit, err := publicTrustService.Audits.GetByReportID(ctx, obj.ID)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Errorf("cannot load document: %w", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
if audit.TrustCenterVisibility == coredata.TrustCenterVisibilityPublic {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
|
|
||||||
privateTrustService, err := r.PrivateTrustService(ctx, obj.ID.TenantID())
|
privateTrustService, err := r.PrivateTrustService(ctx, obj.ID.TenantID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, nil
|
return false, nil
|
||||||
|
|||||||
@@ -53,6 +53,31 @@ func (s AuditService) Get(
|
|||||||
return audit, nil
|
return audit, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s AuditService) GetByReportID(
|
||||||
|
ctx context.Context,
|
||||||
|
reportID gid.GID,
|
||||||
|
) (*coredata.Audit, error) {
|
||||||
|
audit := &coredata.Audit{}
|
||||||
|
|
||||||
|
err := s.svc.pg.WithConn(
|
||||||
|
ctx,
|
||||||
|
func(conn pg.Conn) error {
|
||||||
|
err := audit.LoadByReportID(ctx, conn, s.svc.scope, reportID)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot load audit: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return audit, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s AuditService) ListForOrganizationId(
|
func (s AuditService) ListForOrganizationId(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
organizationID gid.GID,
|
organizationID gid.GID,
|
||||||
|
|||||||
@@ -88,6 +88,55 @@ func (s *DocumentService) ExportPDF(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
documentID gid.GID,
|
documentID gid.GID,
|
||||||
email string,
|
email string,
|
||||||
|
) ([]byte, error) {
|
||||||
|
pdfData, err := s.exportPDFData(ctx, documentID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("cannot export document PDF: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
watermarkedPDF, err := watermarkpdf.AddConfidentialWithTimestamp(pdfData, email)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("cannot add watermark to PDF: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return watermarkedPDF, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DocumentService) ExportPDFWithoutWatermark(
|
||||||
|
ctx context.Context,
|
||||||
|
documentID gid.GID,
|
||||||
|
) ([]byte, error) {
|
||||||
|
return s.exportPDFData(ctx, documentID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s DocumentService) Get(
|
||||||
|
ctx context.Context,
|
||||||
|
documentID gid.GID,
|
||||||
|
) (*coredata.Document, error) {
|
||||||
|
document := &coredata.Document{}
|
||||||
|
|
||||||
|
err := s.svc.pg.WithConn(
|
||||||
|
ctx,
|
||||||
|
func(conn pg.Conn) error {
|
||||||
|
err := document.LoadByID(ctx, conn, s.svc.scope, documentID)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("cannot load document: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return document, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *DocumentService) exportPDFData(
|
||||||
|
ctx context.Context,
|
||||||
|
documentID gid.GID,
|
||||||
) ([]byte, error) {
|
) ([]byte, error) {
|
||||||
document := &coredata.Document{}
|
document := &coredata.Document{}
|
||||||
version := &coredata.DocumentVersion{}
|
version := &coredata.DocumentVersion{}
|
||||||
@@ -100,7 +149,7 @@ func (s *DocumentService) ExportPDF(
|
|||||||
return fmt.Errorf("cannot load document: %w", err)
|
return fmt.Errorf("cannot load document: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !document.ShowOnTrustCenter {
|
if document.TrustCenterVisibility == coredata.TrustCenterVisibilityNone {
|
||||||
return fmt.Errorf("document not visible on trust center")
|
return fmt.Errorf("document not visible on trust center")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,35 +212,5 @@ func (s *DocumentService) ExportPDF(
|
|||||||
return nil, fmt.Errorf("cannot read PDF data: %w", err)
|
return nil, fmt.Errorf("cannot read PDF data: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
watermarkedPDF, err := watermarkpdf.AddConfidentialWithTimestamp(pdfData, email)
|
return pdfData, nil
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot add watermark to PDF: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return watermarkedPDF, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s DocumentService) Get(
|
|
||||||
ctx context.Context,
|
|
||||||
documentID gid.GID,
|
|
||||||
) (*coredata.Document, error) {
|
|
||||||
document := &coredata.Document{}
|
|
||||||
|
|
||||||
err := s.svc.pg.WithConn(
|
|
||||||
ctx,
|
|
||||||
func(conn pg.Conn) error {
|
|
||||||
err := document.LoadByID(ctx, conn, s.svc.scope, documentID)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("cannot load document: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return document, nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,30 @@ func (s ReportService) ExportPDF(
|
|||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
reportID gid.GID,
|
reportID gid.GID,
|
||||||
email string,
|
email string,
|
||||||
|
) ([]byte, error) {
|
||||||
|
pdfData, err := s.exportPDFData(ctx, reportID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("cannot export report PDF: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
watermarkedPDF, err := watermarkpdf.AddConfidentialWithTimestamp(pdfData, email)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("cannot add watermark to PDF: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return watermarkedPDF, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s ReportService) ExportPDFWithoutWatermark(
|
||||||
|
ctx context.Context,
|
||||||
|
reportID gid.GID,
|
||||||
|
) ([]byte, error) {
|
||||||
|
return s.exportPDFData(ctx, reportID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s ReportService) exportPDFData(
|
||||||
|
ctx context.Context,
|
||||||
|
reportID gid.GID,
|
||||||
) ([]byte, error) {
|
) ([]byte, error) {
|
||||||
report, err := s.Get(ctx, reportID)
|
report, err := s.Get(ctx, reportID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -109,10 +133,5 @@ func (s ReportService) ExportPDF(
|
|||||||
return nil, fmt.Errorf("cannot read PDF data: %w", err)
|
return nil, fmt.Errorf("cannot read PDF data: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
watermarkedPDF, err := watermarkpdf.AddConfidentialWithTimestamp(pdfData, email)
|
return pdfData, nil
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("cannot add watermark to PDF: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return watermarkedPDF, nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user