From 288c59a5f2e68ed30e87d19d2ce61f127bc7eb9d Mon Sep 17 00:00:00 2001 From: Sacha Al Himdani Date: Wed, 5 Nov 2025 16:48:58 +0100 Subject: [PATCH] Make descriptions nullable Signed-off-by: Sacha Al Himdani --- .../LinkedRisksDialogQuery.graphql.ts | 4 +- .../src/components/tasks/TaskFormDialog.tsx | 8 +- .../src/components/tasks/TasksCard.tsx | 2 +- .../TaskFormDialogCreateMutation.graphql.ts | 4 +- .../TaskFormDialogFragment.graphql.ts | 4 +- .../TrustCenterReferenceDialog.tsx | 12 +- .../TrustCenterReferencesSection.tsx | 2 +- .../useRiskFormFragment.graphql.ts | 4 +- apps/console/src/hooks/forms/useRiskForm.tsx | 3 +- .../console/src/hooks/forms/useVendorForm.tsx | 3 +- .../FrameworkGraphControlNodeQuery.graphql.ts | 4 +- .../MeasureGraphNodeQuery.graphql.ts | 4 +- .../RiskGraphNodeQuery.graphql.ts | 4 +- .../TrustCenterGraphQuery.graphql.ts | 4 +- ...terReferenceGraphCreateMutation.graphql.ts | 6 +- .../TrustCenterReferenceGraphQuery.graphql.ts | 4 +- ...terReferenceGraphUpdateMutation.graphql.ts | 4 +- .../usePaginatedMeasuresFragment.graphql.ts | 4 +- .../DocumentDetailPageRowFragment.graphql.ts | 4 +- .../DocumentsPageRowFragment.graphql.ts | 4 +- .../dialogs/CreateDocumentDialog.tsx | 4 +- .../documents/dialogs/UpdateVersionDialog.tsx | 4 +- .../FrameworkDetailPageFragment.graphql.ts | 4 +- .../FrameworksPageCardFragment.graphql.ts | 4 +- .../dialogs/FrameworkControlDialog.tsx | 6 +- .../dialogs/FrameworkFormDialog.tsx | 6 +- ...workControlDialogCreateMutation.graphql.ts | 4 +- .../FrameworkControlDialogFragment.graphql.ts | 4 +- .../FrameworkFormDialogMutation.graphql.ts | 4 +- ...ameworkFormDialogUpdateMutation.graphql.ts | 4 +- .../measures/dialog/MeasureFormDialog.tsx | 7 +- ...MeasureFormDialogCreateMutation.graphql.ts | 4 +- ...easureFormDialogMeasureFragment.graphql.ts | 4 +- .../MeasureTasksTabFragment.graphql.ts | 4 +- .../organizations/risks/FormRiskDialog.tsx | 2 + .../FormRiskDialogMutation.graphql.ts | 4 +- .../TasksPageFragment.graphql.ts | 4 +- .../src/Molecules/PageHeader/PageHeader.tsx | 2 +- pkg/coredata/control.go | 76 ++------- pkg/coredata/document.go | 4 +- pkg/coredata/evidence.go | 6 +- pkg/coredata/framework.go | 6 +- pkg/coredata/measure.go | 6 +- pkg/coredata/migrations/20251105T145415Z.sql | 8 + pkg/coredata/risk.go | 6 +- pkg/coredata/task.go | 6 +- pkg/coredata/trust_center_reference.go | 6 +- pkg/probo/control_service.go | 48 ++++-- pkg/probo/framework_service.go | 13 +- pkg/probo/measure_service.go | 16 +- pkg/probo/risk_service.go | 6 +- pkg/probo/task_service.go | 8 +- pkg/probo/trust_center_reference_service.go | 8 +- pkg/server/api/console/v1/schema.graphql | 44 ++--- pkg/server/api/console/v1/schema/schema.go | 152 ++++++------------ pkg/server/api/console/v1/types/types.go | 76 ++++----- pkg/server/api/console/v1/v1_resolver.go | 12 +- pkg/server/api/trust/v1/schema.graphql | 2 +- pkg/server/api/trust/v1/schema/schema.go | 12 +- pkg/server/api/trust/v1/types/types.go | 2 +- 60 files changed, 311 insertions(+), 375 deletions(-) create mode 100644 pkg/coredata/migrations/20251105T145415Z.sql diff --git a/apps/console/src/components/risks/__generated__/LinkedRisksDialogQuery.graphql.ts b/apps/console/src/components/risks/__generated__/LinkedRisksDialogQuery.graphql.ts index b0c9871e4..c760b3564 100644 --- a/apps/console/src/components/risks/__generated__/LinkedRisksDialogQuery.graphql.ts +++ b/apps/console/src/components/risks/__generated__/LinkedRisksDialogQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -19,7 +19,7 @@ export type LinkedRisksDialogQuery$data = { readonly edges: ReadonlyArray<{ readonly node: { readonly category: string; - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly inherentRiskScore: number; readonly name: string; diff --git a/apps/console/src/components/tasks/TaskFormDialog.tsx b/apps/console/src/components/tasks/TaskFormDialog.tsx index 117eb2a01..41fe695c4 100644 --- a/apps/console/src/components/tasks/TaskFormDialog.tsx +++ b/apps/console/src/components/tasks/TaskFormDialog.tsx @@ -71,7 +71,7 @@ export const taskUpdateMutation = graphql` const createTaskSchema = z.object({ name: z.string().min(1), - description: z.string(), + description: z.string().optional().nullable(), timeEstimate: z.string().optional().nullable(), assignedToId: z.preprocess( (val) => (val === "" || val == null ? undefined : val), @@ -86,7 +86,7 @@ const createTaskSchema = z.object({ const updateTaskSchema = z.object({ name: z.string().min(1), - description: z.string(), + description: z.string().optional().nullable(), timeEstimate: z.string().optional().nullable(), assignedToId: z.string().optional(), measureId: z.string().optional(), @@ -138,7 +138,7 @@ export default function TaskFormDialog(props: Props) { input: { taskId: task.id, name: data.name, - description: data.description, + description: data.description || null, timeEstimate: data.timeEstimate || null, deadline: formatDatetime(data.deadline) ?? null, }, @@ -150,7 +150,7 @@ export default function TaskFormDialog(props: Props) { input: { organizationId, name: data.name, - description: data.description, + description: data.description || null, timeEstimate: data.timeEstimate || null, deadline: formatDatetime(data.deadline) ?? null, assignedToId: data.assignedToId, diff --git a/apps/console/src/components/tasks/TasksCard.tsx b/apps/console/src/components/tasks/TasksCard.tsx index 8f8611341..1acb3df69 100644 --- a/apps/console/src/components/tasks/TasksCard.tsx +++ b/apps/console/src/components/tasks/TasksCard.tsx @@ -38,7 +38,7 @@ type Props = { id: string; name: string; state: "TODO" | "DONE"; - description: string; + description?: string | null; measure?: { id: string; name: string; diff --git a/apps/console/src/components/tasks/__generated__/TaskFormDialogCreateMutation.graphql.ts b/apps/console/src/components/tasks/__generated__/TaskFormDialogCreateMutation.graphql.ts index 42574320e..dd1e0b4d1 100644 --- a/apps/console/src/components/tasks/__generated__/TaskFormDialogCreateMutation.graphql.ts +++ b/apps/console/src/components/tasks/__generated__/TaskFormDialogCreateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -13,7 +13,7 @@ import { FragmentRefs } from "relay-runtime"; export type CreateTaskInput = { assignedToId?: string | null | undefined; deadline?: any | null | undefined; - description: string; + description?: string | null | undefined; measureId?: string | null | undefined; name: string; organizationId: string; diff --git a/apps/console/src/components/tasks/__generated__/TaskFormDialogFragment.graphql.ts b/apps/console/src/components/tasks/__generated__/TaskFormDialogFragment.graphql.ts index 2722818a4..d11b9b84a 100644 --- a/apps/console/src/components/tasks/__generated__/TaskFormDialogFragment.graphql.ts +++ b/apps/console/src/components/tasks/__generated__/TaskFormDialogFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<1778d9b73cc75e2097e9c24fdfe83631>> * @lightSyntaxTransform * @nogrep */ @@ -16,7 +16,7 @@ export type TaskFormDialogFragment$data = { readonly id: string; } | null | undefined; readonly deadline: any | null | undefined; - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly measure: { readonly id: string; diff --git a/apps/console/src/components/trustCenter/TrustCenterReferenceDialog.tsx b/apps/console/src/components/trustCenter/TrustCenterReferenceDialog.tsx index 82f47cecd..51fa88d93 100644 --- a/apps/console/src/components/trustCenter/TrustCenterReferenceDialog.tsx +++ b/apps/console/src/components/trustCenter/TrustCenterReferenceDialog.tsx @@ -32,7 +32,7 @@ export type TrustCenterReferenceDialogRef = { openEdit: (reference: { id: string; name: string; - description: string; + description?: string | null; websiteUrl: string; rank: number; }) => void; @@ -41,7 +41,7 @@ export type TrustCenterReferenceDialogRef = { type Reference = { id: string; name: string; - description: string; + description?: string | null; websiteUrl: string; rank: number; }; @@ -90,7 +90,7 @@ export const TrustCenterReferenceDialog = forwardRef> + * @generated SignedSource<<759f9a511cc5c589b3ac366de83adbfe>> * @lightSyntaxTransform * @nogrep */ @@ -13,7 +13,7 @@ export type RiskTreatment = "ACCEPTED" | "AVOIDED" | "MITIGATED" | "TRANSFERRED" import { FragmentRefs } from "relay-runtime"; export type useRiskFormFragment$data = { readonly category: string; - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly inherentImpact: number; readonly inherentLikelihood: number; diff --git a/apps/console/src/hooks/forms/useRiskForm.tsx b/apps/console/src/hooks/forms/useRiskForm.tsx index 262e0d4f1..0516ffbf7 100644 --- a/apps/console/src/hooks/forms/useRiskForm.tsx +++ b/apps/console/src/hooks/forms/useRiskForm.tsx @@ -34,7 +34,7 @@ export type RiskKey = useRiskFormFragment$key & { id: string }; export const riskSchema = z.object({ category: z.string().min(1, "Category is required"), name: z.string().min(1, "Name is required"), - description: z.string().min(1, "Description is required"), + description: z.string().optional().nullable(), ownerId: z.string().min(1, "Owner is required"), treatment: z.enum(["AVOIDED", "MITIGATED", "TRANSFERRED", "ACCEPTED"]), inherentLikelihood: z.number({ coerce: true }).min(1).max(5), @@ -50,6 +50,7 @@ export const useRiskForm = (riskKey?: RiskKey) => { defaultValues: risk ? { ...risk, + description: risk.description ?? undefined, ownerId: risk.owner?.id, } : { diff --git a/apps/console/src/hooks/forms/useVendorForm.tsx b/apps/console/src/hooks/forms/useVendorForm.tsx index 16b2aeba2..bc7122886 100644 --- a/apps/console/src/hooks/forms/useVendorForm.tsx +++ b/apps/console/src/hooks/forms/useVendorForm.tsx @@ -9,7 +9,7 @@ import { useEffect, useMemo } from "react"; const schema = z.object({ name: z.string().min(1, "Name is required"), - description: z.string().min(1, "Description is required"), + description: z.string().optional().nullable(), category: z.string().nullish(), statusPageUrl: z.string().optional(), termsOfServiceUrl: z.string().optional(), @@ -106,6 +106,7 @@ export function useVendorForm(vendorKey: useVendorFormFragment$key) { input: { id: vendor.id, ...data, + description: data.description || null, }, }, }).then(() => { diff --git a/apps/console/src/hooks/graph/__generated__/FrameworkGraphControlNodeQuery.graphql.ts b/apps/console/src/hooks/graph/__generated__/FrameworkGraphControlNodeQuery.graphql.ts index 395aa3036..341196b61 100644 --- a/apps/console/src/hooks/graph/__generated__/FrameworkGraphControlNodeQuery.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/FrameworkGraphControlNodeQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<0e6281a892cbd711d75d22153d4710ea>> + * @generated SignedSource<<54b072cf5a78b17f86e5fc810cac517a>> * @lightSyntaxTransform * @nogrep */ @@ -25,7 +25,7 @@ export type FrameworkGraphControlNodeQuery$data = { }; }>; }; - readonly description?: string; + readonly description?: string | null | undefined; readonly documents?: { readonly __id: string; readonly edges: ReadonlyArray<{ diff --git a/apps/console/src/hooks/graph/__generated__/MeasureGraphNodeQuery.graphql.ts b/apps/console/src/hooks/graph/__generated__/MeasureGraphNodeQuery.graphql.ts index 1338faeef..2b9aa6d9e 100644 --- a/apps/console/src/hooks/graph/__generated__/MeasureGraphNodeQuery.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/MeasureGraphNodeQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<1f413a42110dae78274cf3250fa4db4e>> + * @generated SignedSource<<02c0b1d637edafea060ddb9ee3b3f130>> * @lightSyntaxTransform * @nogrep */ @@ -20,7 +20,7 @@ export type MeasureGraphNodeQuery$data = { readonly controlsInfos?: { readonly totalCount: number; }; - readonly description?: string; + readonly description?: string | null | undefined; readonly evidencesInfos?: { readonly totalCount: number; }; diff --git a/apps/console/src/hooks/graph/__generated__/RiskGraphNodeQuery.graphql.ts b/apps/console/src/hooks/graph/__generated__/RiskGraphNodeQuery.graphql.ts index 1478ae6d4..e98c0aba3 100644 --- a/apps/console/src/hooks/graph/__generated__/RiskGraphNodeQuery.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/RiskGraphNodeQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<36175d4a9f9c3b377ec502f518a47015>> * @lightSyntaxTransform * @nogrep */ @@ -19,7 +19,7 @@ export type RiskGraphNodeQuery$data = { readonly controlsInfo?: { readonly totalCount: number; }; - readonly description?: string; + readonly description?: string | null | undefined; readonly documentsInfo?: { readonly totalCount: number; }; diff --git a/apps/console/src/hooks/graph/__generated__/TrustCenterGraphQuery.graphql.ts b/apps/console/src/hooks/graph/__generated__/TrustCenterGraphQuery.graphql.ts index e45282e17..9ed075c8b 100644 --- a/apps/console/src/hooks/graph/__generated__/TrustCenterGraphQuery.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/TrustCenterGraphQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<285497dfb150c3f02c055a091769f301>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -58,7 +58,7 @@ export type TrustCenterGraphQuery$data = { readonly edges: ReadonlyArray<{ readonly node: { readonly createdAt: any; - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly logoUrl: string; readonly name: string; diff --git a/apps/console/src/hooks/graph/__generated__/TrustCenterReferenceGraphCreateMutation.graphql.ts b/apps/console/src/hooks/graph/__generated__/TrustCenterReferenceGraphCreateMutation.graphql.ts index c94e86e47..c2f432b72 100644 --- a/apps/console/src/hooks/graph/__generated__/TrustCenterReferenceGraphCreateMutation.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/TrustCenterReferenceGraphCreateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<9d17f089c36e0567d217fe339b6382fd>> + * @generated SignedSource<<566b652d24d80b551827cb5d3bf5518c>> * @lightSyntaxTransform * @nogrep */ @@ -10,7 +10,7 @@ import { ConcreteRequest } from 'relay-runtime'; export type CreateTrustCenterReferenceInput = { - description: string; + description?: string | null | undefined; logoFile: any; name: string; trustCenterId: string; @@ -26,7 +26,7 @@ export type TrustCenterReferenceGraphCreateMutation$data = { readonly cursor: any; readonly node: { readonly createdAt: any; - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly logoUrl: string; readonly name: string; diff --git a/apps/console/src/hooks/graph/__generated__/TrustCenterReferenceGraphQuery.graphql.ts b/apps/console/src/hooks/graph/__generated__/TrustCenterReferenceGraphQuery.graphql.ts index ebe7ba952..0bf59db5a 100644 --- a/apps/console/src/hooks/graph/__generated__/TrustCenterReferenceGraphQuery.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/TrustCenterReferenceGraphQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<85556d15b776b3e61e312057a994d482>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -21,7 +21,7 @@ export type TrustCenterReferenceGraphQuery$data = { readonly cursor: any; readonly node: { readonly createdAt: any; - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly logoUrl: string; readonly name: string; diff --git a/apps/console/src/hooks/graph/__generated__/TrustCenterReferenceGraphUpdateMutation.graphql.ts b/apps/console/src/hooks/graph/__generated__/TrustCenterReferenceGraphUpdateMutation.graphql.ts index 4d7e78048..b5975ae7f 100644 --- a/apps/console/src/hooks/graph/__generated__/TrustCenterReferenceGraphUpdateMutation.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/TrustCenterReferenceGraphUpdateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<9f21158abea504110ef50d4e0114a56a>> + * @generated SignedSource<<2b51f7fdbc055d912be03031b258c042>> * @lightSyntaxTransform * @nogrep */ @@ -24,7 +24,7 @@ export type TrustCenterReferenceGraphUpdateMutation$data = { readonly updateTrustCenterReference: { readonly trustCenterReference: { readonly createdAt: any; - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly logoUrl: string; readonly name: string; diff --git a/apps/console/src/hooks/graph/__generated__/usePaginatedMeasuresFragment.graphql.ts b/apps/console/src/hooks/graph/__generated__/usePaginatedMeasuresFragment.graphql.ts index 16dfee881..129675f8d 100644 --- a/apps/console/src/hooks/graph/__generated__/usePaginatedMeasuresFragment.graphql.ts +++ b/apps/console/src/hooks/graph/__generated__/usePaginatedMeasuresFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<4b559d5e004d1657ab8d52cf5770ac79>> + * @generated SignedSource<<53e0a105a9b28a70a1083500cd6b4577>> * @lightSyntaxTransform * @nogrep */ @@ -17,7 +17,7 @@ export type usePaginatedMeasuresFragment$data = { readonly edges: ReadonlyArray<{ readonly node: { readonly category: string; - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly name: string; readonly state: MeasureState; diff --git a/apps/console/src/pages/organizations/documents/__generated__/DocumentDetailPageRowFragment.graphql.ts b/apps/console/src/pages/organizations/documents/__generated__/DocumentDetailPageRowFragment.graphql.ts index 9659b1d3d..12ede3d22 100644 --- a/apps/console/src/pages/organizations/documents/__generated__/DocumentDetailPageRowFragment.graphql.ts +++ b/apps/console/src/pages/organizations/documents/__generated__/DocumentDetailPageRowFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<4a6e4730ab80df159c005156b71a7f3d>> * @lightSyntaxTransform * @nogrep */ @@ -16,7 +16,7 @@ export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED"; import { FragmentRefs } from "relay-runtime"; export type DocumentDetailPageRowFragment$data = { readonly classification: DocumentClassification; - readonly description: string; + readonly description: string | null | undefined; readonly documentType: DocumentType; readonly id: string; readonly owner: { diff --git a/apps/console/src/pages/organizations/documents/__generated__/DocumentsPageRowFragment.graphql.ts b/apps/console/src/pages/organizations/documents/__generated__/DocumentsPageRowFragment.graphql.ts index 8e6094f5f..40806af3f 100644 --- a/apps/console/src/pages/organizations/documents/__generated__/DocumentsPageRowFragment.graphql.ts +++ b/apps/console/src/pages/organizations/documents/__generated__/DocumentsPageRowFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -16,7 +16,7 @@ export type DocumentVersionSignatureState = "REQUESTED" | "SIGNED"; import { FragmentRefs } from "relay-runtime"; export type DocumentsPageRowFragment$data = { readonly classification: DocumentClassification; - readonly description: string; + readonly description: string | null | undefined; readonly documentType: DocumentType; readonly id: string; readonly owner: { diff --git a/apps/console/src/pages/organizations/documents/dialogs/CreateDocumentDialog.tsx b/apps/console/src/pages/organizations/documents/dialogs/CreateDocumentDialog.tsx index 6b5c0955d..532731845 100644 --- a/apps/console/src/pages/organizations/documents/dialogs/CreateDocumentDialog.tsx +++ b/apps/console/src/pages/organizations/documents/dialogs/CreateDocumentDialog.tsx @@ -98,8 +98,8 @@ export function CreateDocumentDialog({ trigger, connection }: Props) { id="content" variant="ghost" autogrow - placeholder={__("Add description")} - aria-label={__("Description")} + placeholder={__("Add content")} + aria-label={__("Content")} {...register("content")} /> diff --git a/apps/console/src/pages/organizations/documents/dialogs/UpdateVersionDialog.tsx b/apps/console/src/pages/organizations/documents/dialogs/UpdateVersionDialog.tsx index 8fa5fe2b6..92e05197b 100644 --- a/apps/console/src/pages/organizations/documents/dialogs/UpdateVersionDialog.tsx +++ b/apps/console/src/pages/organizations/documents/dialogs/UpdateVersionDialog.tsx @@ -175,8 +175,8 @@ export default function UpdateVersionDialog({ variant="ghost" autogrow required - placeholder={__("Add description")} - aria-label={__("Description")} + placeholder={__("Add content")} + aria-label={__("Content")} className="p-6" {...register("content")} /> diff --git a/apps/console/src/pages/organizations/frameworks/__generated__/FrameworkDetailPageFragment.graphql.ts b/apps/console/src/pages/organizations/frameworks/__generated__/FrameworkDetailPageFragment.graphql.ts index 868529c41..ccbebe2d9 100644 --- a/apps/console/src/pages/organizations/frameworks/__generated__/FrameworkDetailPageFragment.graphql.ts +++ b/apps/console/src/pages/organizations/frameworks/__generated__/FrameworkDetailPageFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -24,7 +24,7 @@ export type FrameworkDetailPageFragment$data = { }; }>; }; - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly name: string; readonly organization: { diff --git a/apps/console/src/pages/organizations/frameworks/__generated__/FrameworksPageCardFragment.graphql.ts b/apps/console/src/pages/organizations/frameworks/__generated__/FrameworksPageCardFragment.graphql.ts index 1ecc063c9..9df986da3 100644 --- a/apps/console/src/pages/organizations/frameworks/__generated__/FrameworksPageCardFragment.graphql.ts +++ b/apps/console/src/pages/organizations/frameworks/__generated__/FrameworksPageCardFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<9fdc712e118402371c9951169aac320a>> * @lightSyntaxTransform * @nogrep */ @@ -11,7 +11,7 @@ import { ReaderFragment } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; export type FrameworksPageCardFragment$data = { - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly name: string; readonly " $fragmentType": "FrameworksPageCardFragment"; diff --git a/apps/console/src/pages/organizations/frameworks/dialogs/FrameworkControlDialog.tsx b/apps/console/src/pages/organizations/frameworks/dialogs/FrameworkControlDialog.tsx index 9aa3ba8b0..6cb4fbffb 100644 --- a/apps/console/src/pages/organizations/frameworks/dialogs/FrameworkControlDialog.tsx +++ b/apps/console/src/pages/organizations/frameworks/dialogs/FrameworkControlDialog.tsx @@ -65,7 +65,7 @@ const updateMutation = graphql` const schema = z.object({ name: z.string(), - description: z.string(), + description: z.string().optional().nullable(), sectionTitle: z.string(), status: z.enum(["INCLUDED", "EXCLUDED"]), exclusionJustification: z.string().optional(), @@ -120,7 +120,7 @@ export function FrameworkControlDialog(props: Props) { input: { id: frameworkControl.id, name: data.name, - description: data.description, + description: data.description || null, sectionTitle: data.sectionTitle, status: data.status, exclusionJustification: data.status === "EXCLUDED" ? data.exclusionJustification : null, @@ -134,7 +134,7 @@ export function FrameworkControlDialog(props: Props) { input: { frameworkId: props.frameworkId, name: data.name, - description: data.description, + description: data.description || null, sectionTitle: data.sectionTitle, status: data.status, exclusionJustification: data.status === "EXCLUDED" ? data.exclusionJustification : null, diff --git a/apps/console/src/pages/organizations/frameworks/dialogs/FrameworkFormDialog.tsx b/apps/console/src/pages/organizations/frameworks/dialogs/FrameworkFormDialog.tsx index 5eda28c6b..4bcdb692b 100644 --- a/apps/console/src/pages/organizations/frameworks/dialogs/FrameworkFormDialog.tsx +++ b/apps/console/src/pages/organizations/frameworks/dialogs/FrameworkFormDialog.tsx @@ -49,7 +49,7 @@ type Props = { framework?: { id: string; name: string; - description: string; + description?: string | null; }; ref?: DialogRef; children?: React.ReactNode; @@ -57,7 +57,7 @@ type Props = { const schema = z.object({ name: z.string().min(1).max(255), - description: z.string().max(255).optional(), + description: z.string().max(255).optional().nullable(), }); /** @@ -87,6 +87,7 @@ export function FrameworkFormDialog(props: Props) { input: { id: props.framework.id, ...data, + description: data.description || null, }, }, }); @@ -98,6 +99,7 @@ export function FrameworkFormDialog(props: Props) { variables: { input: { ...data, + description: data.description || null, organizationId: props.organizationId, }, connections: [props.connectionId], diff --git a/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkControlDialogCreateMutation.graphql.ts b/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkControlDialogCreateMutation.graphql.ts index 5d5a7f84a..86092a92f 100644 --- a/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkControlDialogCreateMutation.graphql.ts +++ b/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkControlDialogCreateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<7985268ac23df51ae6187b72c4f33d83>> * @lightSyntaxTransform * @nogrep */ @@ -12,7 +12,7 @@ import { ConcreteRequest } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; export type ControlStatus = "EXCLUDED" | "INCLUDED"; export type CreateControlInput = { - description: string; + description?: string | null | undefined; exclusionJustification?: string | null | undefined; frameworkId: string; name: string; diff --git a/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkControlDialogFragment.graphql.ts b/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkControlDialogFragment.graphql.ts index defdee40a..8da6cf691 100644 --- a/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkControlDialogFragment.graphql.ts +++ b/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkControlDialogFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<8b52b1e3fd91d74821361d9ae652d9bd>> + * @generated SignedSource<<67703eb04d68c2798f5549ed6d948339>> * @lightSyntaxTransform * @nogrep */ @@ -12,7 +12,7 @@ import { ReaderFragment } from 'relay-runtime'; export type ControlStatus = "EXCLUDED" | "INCLUDED"; import { FragmentRefs } from "relay-runtime"; export type FrameworkControlDialogFragment$data = { - readonly description: string; + readonly description: string | null | undefined; readonly exclusionJustification: string | null | undefined; readonly id: string; readonly name: string; diff --git a/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkFormDialogMutation.graphql.ts b/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkFormDialogMutation.graphql.ts index 62fc725d0..975746b3d 100644 --- a/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkFormDialogMutation.graphql.ts +++ b/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkFormDialogMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -11,7 +11,7 @@ import { ConcreteRequest } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; export type CreateFrameworkInput = { - description: string; + description?: string | null | undefined; name: string; organizationId: string; }; diff --git a/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkFormDialogUpdateMutation.graphql.ts b/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkFormDialogUpdateMutation.graphql.ts index 28f92eadf..0280bccc8 100644 --- a/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkFormDialogUpdateMutation.graphql.ts +++ b/apps/console/src/pages/organizations/frameworks/dialogs/__generated__/FrameworkFormDialogUpdateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<530c955a326f52f3c668e9f43788a54f>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -20,7 +20,7 @@ export type FrameworkFormDialogUpdateMutation$variables = { export type FrameworkFormDialogUpdateMutation$data = { readonly updateFramework: { readonly framework: { - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly name: string; }; diff --git a/apps/console/src/pages/organizations/measures/dialog/MeasureFormDialog.tsx b/apps/console/src/pages/organizations/measures/dialog/MeasureFormDialog.tsx index 87e4b34f1..301162da5 100644 --- a/apps/console/src/pages/organizations/measures/dialog/MeasureFormDialog.tsx +++ b/apps/console/src/pages/organizations/measures/dialog/MeasureFormDialog.tsx @@ -52,7 +52,7 @@ const measureCreateMutation = graphql` const measureSchema = z.object({ name: z.string().min(1, "Name is required"), - description: z.string().min(1, "Description is required"), + description: z.string().optional().nullable(), category: z.string().min(1, "Category is required"), state: z.enum(measureStates), }); @@ -93,7 +93,7 @@ export default function MeasureFormDialog(props: Props) { input: { id: measure.id, name: data.name, - description: data.description, + description: data.description || null, category: data.category, state: data.state, }, @@ -105,7 +105,7 @@ export default function MeasureFormDialog(props: Props) { input: { organizationId, name: data.name, - description: data.description, + description: data.description || null, category: data.category, }, connections: [props.connection!], @@ -145,7 +145,6 @@ export default function MeasureFormDialog(props: Props) { label={__("Description")} placeholder={__("Add description")} type="textarea" - required /> {/* Properties form */} diff --git a/apps/console/src/pages/organizations/measures/dialog/__generated__/MeasureFormDialogCreateMutation.graphql.ts b/apps/console/src/pages/organizations/measures/dialog/__generated__/MeasureFormDialogCreateMutation.graphql.ts index edafcbaf5..47509bd2c 100644 --- a/apps/console/src/pages/organizations/measures/dialog/__generated__/MeasureFormDialogCreateMutation.graphql.ts +++ b/apps/console/src/pages/organizations/measures/dialog/__generated__/MeasureFormDialogCreateMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<09acdf5a03dd4ad1fab64c2c08564a2a>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -12,7 +12,7 @@ import { ConcreteRequest } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; export type CreateMeasureInput = { category: string; - description: string; + description?: string | null | undefined; name: string; organizationId: string; }; diff --git a/apps/console/src/pages/organizations/measures/dialog/__generated__/MeasureFormDialogMeasureFragment.graphql.ts b/apps/console/src/pages/organizations/measures/dialog/__generated__/MeasureFormDialogMeasureFragment.graphql.ts index e729e6ffb..71a1d89d2 100644 --- a/apps/console/src/pages/organizations/measures/dialog/__generated__/MeasureFormDialogMeasureFragment.graphql.ts +++ b/apps/console/src/pages/organizations/measures/dialog/__generated__/MeasureFormDialogMeasureFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -13,7 +13,7 @@ export type MeasureState = "IMPLEMENTED" | "IN_PROGRESS" | "NOT_APPLICABLE" | "N import { FragmentRefs } from "relay-runtime"; export type MeasureFormDialogMeasureFragment$data = { readonly category: string; - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly name: string; readonly state: MeasureState; diff --git a/apps/console/src/pages/organizations/measures/tabs/__generated__/MeasureTasksTabFragment.graphql.ts b/apps/console/src/pages/organizations/measures/tabs/__generated__/MeasureTasksTabFragment.graphql.ts index 4322a5fb1..c2dd2582e 100644 --- a/apps/console/src/pages/organizations/measures/tabs/__generated__/MeasureTasksTabFragment.graphql.ts +++ b/apps/console/src/pages/organizations/measures/tabs/__generated__/MeasureTasksTabFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<67fd0b26613189fa036f7873138787d7>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -20,7 +20,7 @@ export type MeasureTasksTabFragment$data = { readonly fullName: string; readonly id: string; } | null | undefined; - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly name: string; readonly state: TaskState; diff --git a/apps/console/src/pages/organizations/risks/FormRiskDialog.tsx b/apps/console/src/pages/organizations/risks/FormRiskDialog.tsx index d6de4e277..2d0e79d16 100644 --- a/apps/console/src/pages/organizations/risks/FormRiskDialog.tsx +++ b/apps/console/src/pages/organizations/risks/FormRiskDialog.tsx @@ -110,6 +110,7 @@ export default function FormRiskDialog({ input: { id: risk.id, ...data, + description: data.description || null, }, }, successMessage: __("Risk updated successfully."), @@ -124,6 +125,7 @@ export default function FormRiskDialog({ variables: { input: { ...data, + description: data.description || null, organizationId, }, connections: [connection!], diff --git a/apps/console/src/pages/organizations/risks/__generated__/FormRiskDialogMutation.graphql.ts b/apps/console/src/pages/organizations/risks/__generated__/FormRiskDialogMutation.graphql.ts index 4cf4f9081..73dcc3042 100644 --- a/apps/console/src/pages/organizations/risks/__generated__/FormRiskDialogMutation.graphql.ts +++ b/apps/console/src/pages/organizations/risks/__generated__/FormRiskDialogMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<66f4e8603a811d1fb363ae88ea697b22>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -13,7 +13,7 @@ import { FragmentRefs } from "relay-runtime"; export type RiskTreatment = "ACCEPTED" | "AVOIDED" | "MITIGATED" | "TRANSFERRED"; export type CreateRiskInput = { category: string; - description: string; + description?: string | null | undefined; inherentImpact: number; inherentLikelihood: number; name: string; diff --git a/apps/console/src/pages/organizations/tasks/__generated__/TasksPageFragment.graphql.ts b/apps/console/src/pages/organizations/tasks/__generated__/TasksPageFragment.graphql.ts index d5e2351ce..da8f3760b 100644 --- a/apps/console/src/pages/organizations/tasks/__generated__/TasksPageFragment.graphql.ts +++ b/apps/console/src/pages/organizations/tasks/__generated__/TasksPageFragment.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<0fbb86bdf90b3ec4e0ec6ea8253eef4c>> + * @generated SignedSource<<8bba8d318de0f4b0d28a8fba8b8e0bdf>> * @lightSyntaxTransform * @nogrep */ @@ -21,7 +21,7 @@ export type TasksPageFragment$data = { readonly fullName: string; readonly id: string; } | null | undefined; - readonly description: string; + readonly description: string | null | undefined; readonly id: string; readonly measure: { readonly id: string; diff --git a/packages/ui/src/Molecules/PageHeader/PageHeader.tsx b/packages/ui/src/Molecules/PageHeader/PageHeader.tsx index 762f07b60..9e18e9790 100644 --- a/packages/ui/src/Molecules/PageHeader/PageHeader.tsx +++ b/packages/ui/src/Molecules/PageHeader/PageHeader.tsx @@ -2,7 +2,7 @@ import type { PropsWithChildren, ReactNode } from "react"; type Props = PropsWithChildren<{ title: ReactNode; - description?: string; + description?: string | null; }>; export function PageHeader({ title, description, children }: Props) { diff --git a/pkg/coredata/control.go b/pkg/coredata/control.go index bc3e5da33..a373be3e7 100644 --- a/pkg/coredata/control.go +++ b/pkg/coredata/control.go @@ -21,11 +21,11 @@ import ( "maps" "time" - "go.probo.inc/probo/pkg/gid" - "go.probo.inc/probo/pkg/page" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgconn" "go.gearno.de/kit/pg" + "go.probo.inc/probo/pkg/gid" + "go.probo.inc/probo/pkg/page" ) type ( @@ -34,7 +34,7 @@ type ( SectionTitle string `db:"section_title"` FrameworkID gid.GID `db:"framework_id"` Name string `db:"name"` - Description string `db:"description"` + Description *string `db:"description"` Status ControlStatus `db:"status"` ExclusionJustification *string `db:"exclusion_justification"` CreatedAt time.Time `db:"created_at"` @@ -43,14 +43,6 @@ type ( Controls []*Control - UpdateControlParams struct { - Name *string - Description *string - SectionTitle *string - Status *ControlStatus - ExclusionJustification *string - } - ErrControlNotFound struct { Identifier string } @@ -793,79 +785,45 @@ func (c *Control) Update( ctx context.Context, conn pg.Conn, scope Scoper, - params UpdateControlParams, ) error { q := ` UPDATE controls SET - name = COALESCE(@name, name), - description = COALESCE(@description, description), - section_title = COALESCE(@section_title, section_title), - status = COALESCE(@status, status), - exclusion_justification = COALESCE(@exclusion_justification, exclusion_justification), + name = @name, + description = @description, + section_title = @section_title, + status = @status, + exclusion_justification = @exclusion_justification, updated_at = @updated_at WHERE %s AND id = @control_id -RETURNING - id, - framework_id, - name, - description, - section_title, - status, - exclusion_justification, - created_at, - updated_at ` q = fmt.Sprintf(q, scope.SQLFragment()) args := pgx.StrictNamedArgs{ "control_id": c.ID, - "section_title": params.SectionTitle, - "status": params.Status, - "exclusion_justification": params.ExclusionJustification, - "updated_at": time.Now(), - } - - if params.Name != nil { - args["name"] = *params.Name - } - if params.Description != nil { - args["description"] = *params.Description - } - - if params.Status != nil { - args["status"] = *params.Status - } - if params.ExclusionJustification != nil { - args["exclusion_justification"] = *params.ExclusionJustification + "name": c.Name, + "description": c.Description, + "section_title": c.SectionTitle, + "status": c.Status, + "exclusion_justification": c.ExclusionJustification, + "updated_at": c.UpdatedAt, } maps.Copy(args, scope.SQLArguments()) - rows, err := conn.Query(ctx, q, args) - if err != nil { - return fmt.Errorf("cannot query controls: %w", err) - } - - control, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[Control]) + _, err := conn.Exec(ctx, q, args) if err != nil { var pgErr *pgconn.PgError if errors.As(err, &pgErr) { if pgErr.Code == "23505" && pgErr.ConstraintName == "controls_framework_ref_unique" { - sectionTitle := "" - if params.SectionTitle != nil { - sectionTitle = *params.SectionTitle - } return &ErrControlAlreadyExists{ - message: fmt.Sprintf("control with section_title %q already exists", sectionTitle), + message: fmt.Sprintf("control with section_title %q already exists", c.SectionTitle), } } } - return fmt.Errorf("cannot collect control: %w", err) + return fmt.Errorf("cannot update control: %w", err) } - *c = control - return nil } diff --git a/pkg/coredata/document.go b/pkg/coredata/document.go index 9957aa263..28fb27656 100644 --- a/pkg/coredata/document.go +++ b/pkg/coredata/document.go @@ -21,10 +21,10 @@ import ( "maps" "time" - "go.probo.inc/probo/pkg/gid" - "go.probo.inc/probo/pkg/page" "github.com/jackc/pgx/v5" "go.gearno.de/kit/pg" + "go.probo.inc/probo/pkg/gid" + "go.probo.inc/probo/pkg/page" ) type ( diff --git a/pkg/coredata/evidence.go b/pkg/coredata/evidence.go index 2a05aaae2..4c42f2440 100644 --- a/pkg/coredata/evidence.go +++ b/pkg/coredata/evidence.go @@ -21,11 +21,11 @@ import ( "maps" "time" - "go.probo.inc/probo/pkg/gid" - "go.probo.inc/probo/pkg/page" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgconn" "go.gearno.de/kit/pg" + "go.probo.inc/probo/pkg/gid" + "go.probo.inc/probo/pkg/page" ) type ( @@ -38,7 +38,7 @@ type ( Type EvidenceType `db:"type"` URL string `db:"url"` EvidenceFileId *gid.GID `db:"evidence_file_id"` - Description string `db:"description"` + Description *string `db:"description"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` } diff --git a/pkg/coredata/framework.go b/pkg/coredata/framework.go index f74899f85..11430a277 100644 --- a/pkg/coredata/framework.go +++ b/pkg/coredata/framework.go @@ -21,11 +21,11 @@ import ( "maps" "time" - "go.probo.inc/probo/pkg/gid" - "go.probo.inc/probo/pkg/page" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgconn" "go.gearno.de/kit/pg" + "go.probo.inc/probo/pkg/gid" + "go.probo.inc/probo/pkg/page" ) type ( @@ -34,7 +34,7 @@ type ( OrganizationID gid.GID `db:"organization_id"` ReferenceID string `db:"reference_id"` Name string `db:"name"` - Description string `db:"description"` + Description *string `db:"description"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` } diff --git a/pkg/coredata/measure.go b/pkg/coredata/measure.go index 952c15a5c..bf80bdb3e 100644 --- a/pkg/coredata/measure.go +++ b/pkg/coredata/measure.go @@ -21,10 +21,10 @@ import ( "maps" "time" - "go.probo.inc/probo/pkg/gid" - "go.probo.inc/probo/pkg/page" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgconn" + "go.probo.inc/probo/pkg/gid" + "go.probo.inc/probo/pkg/page" "go.gearno.de/kit/pg" ) @@ -35,7 +35,7 @@ type ( OrganizationID gid.GID `db:"organization_id"` Category string `db:"category"` Name string `db:"name"` - Description string `db:"description"` + Description *string `db:"description"` State MeasureState `db:"state"` ReferenceID string `db:"reference_id"` CreatedAt time.Time `db:"created_at"` diff --git a/pkg/coredata/migrations/20251105T145415Z.sql b/pkg/coredata/migrations/20251105T145415Z.sql new file mode 100644 index 000000000..bb783f5eb --- /dev/null +++ b/pkg/coredata/migrations/20251105T145415Z.sql @@ -0,0 +1,8 @@ +ALTER TABLE controls ALTER COLUMN description DROP NOT NULL; +ALTER TABLE documents ALTER COLUMN description DROP NOT NULL; +ALTER TABLE documents ALTER COLUMN description DROP DEFAULT; +ALTER TABLE evidences ALTER COLUMN description DROP NOT NULL; +ALTER TABLE frameworks ALTER COLUMN description DROP NOT NULL; +ALTER TABLE measures ALTER COLUMN description DROP NOT NULL; +ALTER TABLE tasks ALTER COLUMN description DROP NOT NULL; +ALTER TABLE trust_center_references ALTER COLUMN description DROP NOT NULL; diff --git a/pkg/coredata/risk.go b/pkg/coredata/risk.go index bcd78b821..159f90855 100644 --- a/pkg/coredata/risk.go +++ b/pkg/coredata/risk.go @@ -21,10 +21,10 @@ import ( "maps" "time" - "go.probo.inc/probo/pkg/gid" - "go.probo.inc/probo/pkg/page" "github.com/jackc/pgx/v5" "go.gearno.de/kit/pg" + "go.probo.inc/probo/pkg/gid" + "go.probo.inc/probo/pkg/page" ) type ( @@ -32,7 +32,7 @@ type ( ID gid.GID `db:"id"` OrganizationID gid.GID `db:"organization_id"` Name string `db:"name"` - Description string `db:"description"` + Description *string `db:"description"` Category string `db:"category"` Treatment RiskTreatment `db:"treatment"` Note string `db:"note"` diff --git a/pkg/coredata/task.go b/pkg/coredata/task.go index 9b4692ab0..acbbc895b 100644 --- a/pkg/coredata/task.go +++ b/pkg/coredata/task.go @@ -21,10 +21,10 @@ import ( "maps" "time" - "go.probo.inc/probo/pkg/gid" - "go.probo.inc/probo/pkg/page" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgconn" + "go.probo.inc/probo/pkg/gid" + "go.probo.inc/probo/pkg/page" "go.gearno.de/kit/pg" ) @@ -35,7 +35,7 @@ type ( OrganizationID gid.GID `db:"organization_id"` MeasureID *gid.GID `db:"measure_id"` Name string `db:"name"` - Description string `db:"description"` + Description *string `db:"description"` State TaskState `db:"state"` ReferenceID string `db:"reference_id"` TimeEstimate *time.Duration `db:"time_estimate"` diff --git a/pkg/coredata/trust_center_reference.go b/pkg/coredata/trust_center_reference.go index c42ddf0b9..31f5d98f9 100644 --- a/pkg/coredata/trust_center_reference.go +++ b/pkg/coredata/trust_center_reference.go @@ -21,11 +21,11 @@ import ( "maps" "time" - "go.probo.inc/probo/pkg/gid" - "go.probo.inc/probo/pkg/page" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgconn" "go.gearno.de/kit/pg" + "go.probo.inc/probo/pkg/gid" + "go.probo.inc/probo/pkg/page" ) type ( @@ -33,7 +33,7 @@ type ( ID gid.GID `db:"id"` TrustCenterID gid.GID `db:"trust_center_id"` Name string `db:"name"` - Description string `db:"description"` + Description *string `db:"description"` WebsiteURL string `db:"website_url"` LogoFileID gid.GID `db:"logo_file_id"` Rank int `db:"rank"` diff --git a/pkg/probo/control_service.go b/pkg/probo/control_service.go index 669ce9ac2..df0c96e59 100644 --- a/pkg/probo/control_service.go +++ b/pkg/probo/control_service.go @@ -19,10 +19,10 @@ import ( "fmt" "time" + "go.gearno.de/kit/pg" "go.probo.inc/probo/pkg/coredata" "go.probo.inc/probo/pkg/gid" "go.probo.inc/probo/pkg/page" - "go.gearno.de/kit/pg" ) type ( @@ -34,7 +34,7 @@ type ( ID gid.GID FrameworkID gid.GID Name string - Description string + Description *string SectionTitle string Status *coredata.ControlStatus ExclusionJustification *string @@ -43,7 +43,7 @@ type ( UpdateControlRequest struct { ID gid.GID Name *string - Description *string + Description **string SectionTitle *string Status *coredata.ControlStatus ExclusionJustification *string @@ -765,21 +765,37 @@ func (s ControlService) Update( ctx context.Context, req UpdateControlRequest, ) (*coredata.Control, error) { - params := coredata.UpdateControlParams{ - Name: req.Name, - Description: req.Description, - SectionTitle: req.SectionTitle, - Status: req.Status, - ExclusionJustification: req.ExclusionJustification, - } - control := &coredata.Control{ID: req.ID} - err := s.svc.pg.WithTx( - ctx, - func(conn pg.Conn) error { - return control.Update(ctx, conn, s.svc.scope, params) - }) + err := s.svc.pg.WithTx(ctx, func(conn pg.Conn) error { + if err := control.LoadByID(ctx, conn, s.svc.scope, req.ID); err != nil { + return fmt.Errorf("cannot load control: %w", err) + } + + if req.Name != nil { + control.Name = *req.Name + } + + if req.Description != nil { + control.Description = *req.Description + } + + if req.SectionTitle != nil { + control.SectionTitle = *req.SectionTitle + } + + if req.Status != nil { + control.Status = *req.Status + } + + if req.ExclusionJustification != nil { + control.ExclusionJustification = req.ExclusionJustification + } + + control.UpdatedAt = time.Now() + + return control.Update(ctx, conn, s.svc.scope) + }) if err != nil { return nil, fmt.Errorf("cannot update control: %w", err) } diff --git a/pkg/probo/framework_service.go b/pkg/probo/framework_service.go index 78b7eeab3..f7d1d9e0a 100644 --- a/pkg/probo/framework_service.go +++ b/pkg/probo/framework_service.go @@ -25,6 +25,9 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/s3" + "go.gearno.de/crypto/uuid" + "go.gearno.de/kit/pg" + "go.gearno.de/x/ref" "go.probo.inc/probo/packages/emails" "go.probo.inc/probo/pkg/coredata" "go.probo.inc/probo/pkg/gid" @@ -32,9 +35,6 @@ import ( "go.probo.inc/probo/pkg/page" "go.probo.inc/probo/pkg/slug" "go.probo.inc/probo/pkg/soagen" - "go.gearno.de/crypto/uuid" - "go.gearno.de/kit/pg" - "go.gearno.de/x/ref" ) const ( @@ -51,13 +51,13 @@ type ( CreateFrameworkRequest struct { OrganizationID gid.GID Name string - Description string + Description *string } UpdateFrameworkRequest struct { ID gid.GID Name *string - Description *string + Description **string } ImportFrameworkRequest struct { @@ -487,12 +487,13 @@ func (s FrameworkService) Import( controlID := gid.New(organization.ID.TenantID(), coredata.ControlEntityType) now := time.Now() + description := control.Description control := &coredata.Control{ ID: controlID, FrameworkID: frameworkID, SectionTitle: control.ID, Name: control.Name, - Description: control.Description, + Description: &description, Status: coredata.ControlStatusIncluded, CreatedAt: now, UpdatedAt: now, diff --git a/pkg/probo/measure_service.go b/pkg/probo/measure_service.go index 1b75ce26d..ae3e78fb4 100644 --- a/pkg/probo/measure_service.go +++ b/pkg/probo/measure_service.go @@ -19,11 +19,11 @@ import ( "fmt" "time" + "go.gearno.de/crypto/uuid" + "go.gearno.de/kit/pg" "go.probo.inc/probo/pkg/coredata" "go.probo.inc/probo/pkg/gid" "go.probo.inc/probo/pkg/page" - "go.gearno.de/crypto/uuid" - "go.gearno.de/kit/pg" ) type ( @@ -34,14 +34,14 @@ type ( CreateMeasureRequest struct { OrganizationID gid.GID Name string - Description string + Description *string Category string } UpdateMeasureRequest struct { ID gid.GID Name *string - Description *string + Description **string Category *string State *coredata.MeasureState } @@ -296,7 +296,7 @@ func (s MeasureService) Import( ID: measureID, OrganizationID: organization.ID, Name: req.Measures[i].Name, - Description: "", + Description: nil, Category: req.Measures[i].Category, State: coredata.MeasureStateNotStarted, ReferenceID: req.Measures[i].ReferenceID, @@ -313,12 +313,13 @@ func (s MeasureService) Import( for j := range req.Measures[i].Tasks { taskID := gid.New(organization.ID.TenantID(), coredata.TaskEntityType) + taskDescription := req.Measures[i].Tasks[j].Description task := &coredata.Task{ ID: taskID, OrganizationID: organizationID, MeasureID: &measure.ID, Name: req.Measures[i].Tasks[j].Name, - Description: req.Measures[i].Tasks[j].Description, + Description: &taskDescription, ReferenceID: req.Measures[i].Tasks[j].ReferenceID, State: coredata.TaskStateTodo, CreatedAt: now, @@ -332,13 +333,14 @@ func (s MeasureService) Import( for k := range req.Measures[i].Tasks[j].RequestedEvidences { evidenceID := gid.New(organizationID.TenantID(), coredata.EvidenceEntityType) + evidenceDescription := req.Measures[i].Tasks[j].RequestedEvidences[k].Name evidence := &coredata.Evidence{ State: coredata.EvidenceStateRequested, ID: evidenceID, TaskID: &task.ID, ReferenceID: req.Measures[i].Tasks[j].RequestedEvidences[k].ReferenceID, Type: req.Measures[i].Tasks[j].RequestedEvidences[k].Type, - Description: req.Measures[i].Tasks[j].RequestedEvidences[k].Name, + Description: &evidenceDescription, CreatedAt: now, UpdatedAt: now, } diff --git a/pkg/probo/risk_service.go b/pkg/probo/risk_service.go index ebabcfcd2..2991375a6 100644 --- a/pkg/probo/risk_service.go +++ b/pkg/probo/risk_service.go @@ -19,10 +19,10 @@ import ( "fmt" "time" + "go.gearno.de/kit/pg" "go.probo.inc/probo/pkg/coredata" "go.probo.inc/probo/pkg/gid" "go.probo.inc/probo/pkg/page" - "go.gearno.de/kit/pg" ) type ( @@ -33,7 +33,7 @@ type ( CreateRiskRequest struct { OrganizationID gid.GID Name string - Description string + Description *string Category string Treatment coredata.RiskTreatment OwnerID *gid.GID @@ -47,7 +47,7 @@ type ( UpdateRiskRequest struct { ID gid.GID Name *string - Description *string + Description **string Category *string Treatment *coredata.RiskTreatment OwnerID **gid.GID diff --git a/pkg/probo/task_service.go b/pkg/probo/task_service.go index 123f6e7bb..5de2a810e 100644 --- a/pkg/probo/task_service.go +++ b/pkg/probo/task_service.go @@ -19,11 +19,11 @@ import ( "fmt" "time" + "go.gearno.de/crypto/uuid" + "go.gearno.de/kit/pg" "go.probo.inc/probo/pkg/coredata" "go.probo.inc/probo/pkg/gid" "go.probo.inc/probo/pkg/page" - "go.gearno.de/crypto/uuid" - "go.gearno.de/kit/pg" ) type ( @@ -35,7 +35,7 @@ type ( OrganizationID gid.GID MeasureID *gid.GID Name string - Description string + Description *string TimeEstimate *time.Duration AssignedToID *gid.GID Deadline *time.Time @@ -44,7 +44,7 @@ type ( UpdateTaskRequest struct { TaskID gid.GID Name *string - Description *string + Description **string State *coredata.TaskState TimeEstimate **time.Duration Deadline **time.Time diff --git a/pkg/probo/trust_center_reference_service.go b/pkg/probo/trust_center_reference_service.go index b0cded746..2bd524dd6 100644 --- a/pkg/probo/trust_center_reference_service.go +++ b/pkg/probo/trust_center_reference_service.go @@ -26,11 +26,11 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/s3" + "go.gearno.de/crypto/uuid" + "go.gearno.de/kit/pg" "go.probo.inc/probo/pkg/coredata" "go.probo.inc/probo/pkg/gid" "go.probo.inc/probo/pkg/page" - "go.gearno.de/crypto/uuid" - "go.gearno.de/kit/pg" ) type ( @@ -41,7 +41,7 @@ type ( CreateTrustCenterReferenceRequest struct { TrustCenterID gid.GID Name string - Description string + Description *string WebsiteURL string LogoFile File } @@ -49,7 +49,7 @@ type ( UpdateTrustCenterReferenceRequest struct { ID gid.GID Name *string - Description *string + Description **string WebsiteURL *string LogoFile *File Rank *int diff --git a/pkg/server/api/console/v1/schema.graphql b/pkg/server/api/console/v1/schema.graphql index d3fa64241..97ca41a35 100644 --- a/pkg/server/api/console/v1/schema.graphql +++ b/pkg/server/api/console/v1/schema.graphql @@ -2020,7 +2020,7 @@ type VendorDataPrivacyAgreement implements Node { type Framework implements Node { id: ID! name: String! - description: String! + description: String organization: Organization! @goField(forceResolver: true) @@ -2041,7 +2041,7 @@ type Control implements Node { id: ID! sectionTitle: String! name: String! - description: String! + description: String status: ControlStatus! exclusionJustification: String @@ -2089,7 +2089,7 @@ type Measure implements Node { id: ID! category: String! name: String! - description: String! + description: String state: MeasureState! evidences( @@ -2133,7 +2133,7 @@ type Measure implements Node { type Task implements Node { id: ID! name: String! - description: String! + description: String state: TaskState! timeEstimate: Duration deadline: Datetime @@ -2161,7 +2161,7 @@ type Evidence implements Node { type: EvidenceType! file: File @goField(forceResolver: true) url: String - description: String! + description: String task: Task @goField(forceResolver: true) measure: Measure! @goField(forceResolver: true) @@ -2173,7 +2173,7 @@ type Evidence implements Node { type Document implements Node { id: ID! title: String! - description: String! + description: String documentType: DocumentType! classification: DocumentClassification! currentPublishedVersion: Int @@ -2207,7 +2207,7 @@ type Risk implements Node { id: ID! snapshotId: ID name: String! - description: String! + description: String category: String! treatment: RiskTreatment! inherentLikelihood: Int! @@ -2498,7 +2498,7 @@ type TrustCenterAccessEdge { type TrustCenterReference implements Node { id: ID! name: String! - description: String! + description: String websiteUrl: String! logoUrl: String! @goField(forceResolver: true) rank: Int! @@ -3303,7 +3303,7 @@ input DeleteTrustCenterAccessInput { input CreateTrustCenterReferenceInput { trustCenterId: ID! name: String! - description: String! + description: String websiteUrl: String! logoFile: Upload! } @@ -3311,7 +3311,7 @@ input CreateTrustCenterReferenceInput { input UpdateTrustCenterReferenceInput { id: ID! name: String - description: String + description: String @goField(omittable: true) websiteUrl: String logoFile: Upload rank: Int @@ -3464,13 +3464,13 @@ input DeletePeopleInput { input CreateFrameworkInput { organizationId: ID! name: String! - description: String! + description: String } input UpdateFrameworkInput { id: ID! name: String - description: String + description: String @goField(omittable: true) } input ImportFrameworkInput { @@ -3489,14 +3489,14 @@ input ExportFrameworkInput { input CreateMeasureInput { organizationId: ID! name: String! - description: String! + description: String category: String! } input UpdateMeasureInput { id: ID! name: String - description: String + description: String @goField(omittable: true) category: String state: MeasureState } @@ -3510,7 +3510,7 @@ input CreateTaskInput { organizationId: ID! measureId: ID name: String! - description: String! + description: String timeEstimate: Duration assignedToId: ID deadline: Datetime @@ -3519,7 +3519,7 @@ input CreateTaskInput { input UpdateTaskInput { taskId: ID! name: String - description: String + description: String @goField(omittable: true) state: TaskState timeEstimate: Duration @goField(omittable: true) deadline: Datetime @goField(omittable: true) @@ -3581,7 +3581,7 @@ input DeleteControlSnapshotMappingInput { input CreateRiskInput { organizationId: ID! name: String! - description: String! + description: String category: String! ownerId: ID treatment: RiskTreatment! @@ -3595,7 +3595,7 @@ input CreateRiskInput { input UpdateRiskInput { id: ID! name: String - description: String + description: String @goField(omittable: true) category: String ownerId: ID @goField(omittable: true) treatment: RiskTreatment @@ -3644,7 +3644,7 @@ input RequestEvidenceInput { taskId: ID! name: String! type: EvidenceType! - description: String! + description: String } input FulfillEvidenceInput { @@ -3660,7 +3660,7 @@ input CreateEvidenceInput { type: EvidenceType! url: String file: Upload - description: String! + description: String } input DeleteEvidenceInput { @@ -3774,7 +3774,7 @@ input CreateControlInput { frameworkId: ID! sectionTitle: String! name: String! - description: String! + description: String status: ControlStatus! exclusionJustification: String } @@ -3783,7 +3783,7 @@ input UpdateControlInput { id: ID! sectionTitle: String name: String - description: String + description: String @goField(omittable: true) status: ControlStatus exclusionJustification: String } diff --git a/pkg/server/api/console/v1/schema/schema.go b/pkg/server/api/console/v1/schema/schema.go index 1c6b77729..d0be73968 100644 --- a/pkg/server/api/console/v1/schema/schema.go +++ b/pkg/server/api/console/v1/schema/schema.go @@ -11761,7 +11761,7 @@ type VendorDataPrivacyAgreement implements Node { type Framework implements Node { id: ID! name: String! - description: String! + description: String organization: Organization! @goField(forceResolver: true) @@ -11782,7 +11782,7 @@ type Control implements Node { id: ID! sectionTitle: String! name: String! - description: String! + description: String status: ControlStatus! exclusionJustification: String @@ -11830,7 +11830,7 @@ type Measure implements Node { id: ID! category: String! name: String! - description: String! + description: String state: MeasureState! evidences( @@ -11874,7 +11874,7 @@ type Measure implements Node { type Task implements Node { id: ID! name: String! - description: String! + description: String state: TaskState! timeEstimate: Duration deadline: Datetime @@ -11902,7 +11902,7 @@ type Evidence implements Node { type: EvidenceType! file: File @goField(forceResolver: true) url: String - description: String! + description: String task: Task @goField(forceResolver: true) measure: Measure! @goField(forceResolver: true) @@ -11914,7 +11914,7 @@ type Evidence implements Node { type Document implements Node { id: ID! title: String! - description: String! + description: String documentType: DocumentType! classification: DocumentClassification! currentPublishedVersion: Int @@ -11948,7 +11948,7 @@ type Risk implements Node { id: ID! snapshotId: ID name: String! - description: String! + description: String category: String! treatment: RiskTreatment! inherentLikelihood: Int! @@ -12239,7 +12239,7 @@ type TrustCenterAccessEdge { type TrustCenterReference implements Node { id: ID! name: String! - description: String! + description: String websiteUrl: String! logoUrl: String! @goField(forceResolver: true) rank: Int! @@ -13044,7 +13044,7 @@ input DeleteTrustCenterAccessInput { input CreateTrustCenterReferenceInput { trustCenterId: ID! name: String! - description: String! + description: String websiteUrl: String! logoFile: Upload! } @@ -13052,7 +13052,7 @@ input CreateTrustCenterReferenceInput { input UpdateTrustCenterReferenceInput { id: ID! name: String - description: String + description: String @goField(omittable: true) websiteUrl: String logoFile: Upload rank: Int @@ -13205,13 +13205,13 @@ input DeletePeopleInput { input CreateFrameworkInput { organizationId: ID! name: String! - description: String! + description: String } input UpdateFrameworkInput { id: ID! name: String - description: String + description: String @goField(omittable: true) } input ImportFrameworkInput { @@ -13230,14 +13230,14 @@ input ExportFrameworkInput { input CreateMeasureInput { organizationId: ID! name: String! - description: String! + description: String category: String! } input UpdateMeasureInput { id: ID! name: String - description: String + description: String @goField(omittable: true) category: String state: MeasureState } @@ -13251,7 +13251,7 @@ input CreateTaskInput { organizationId: ID! measureId: ID name: String! - description: String! + description: String timeEstimate: Duration assignedToId: ID deadline: Datetime @@ -13260,7 +13260,7 @@ input CreateTaskInput { input UpdateTaskInput { taskId: ID! name: String - description: String + description: String @goField(omittable: true) state: TaskState timeEstimate: Duration @goField(omittable: true) deadline: Datetime @goField(omittable: true) @@ -13322,7 +13322,7 @@ input DeleteControlSnapshotMappingInput { input CreateRiskInput { organizationId: ID! name: String! - description: String! + description: String category: String! ownerId: ID treatment: RiskTreatment! @@ -13336,7 +13336,7 @@ input CreateRiskInput { input UpdateRiskInput { id: ID! name: String - description: String + description: String @goField(omittable: true) category: String ownerId: ID @goField(omittable: true) treatment: RiskTreatment @@ -13385,7 +13385,7 @@ input RequestEvidenceInput { taskId: ID! name: String! type: EvidenceType! - description: String! + description: String } input FulfillEvidenceInput { @@ -13401,7 +13401,7 @@ input CreateEvidenceInput { type: EvidenceType! url: String file: Upload - description: String! + description: String } input DeleteEvidenceInput { @@ -13515,7 +13515,7 @@ input CreateControlInput { frameworkId: ID! sectionTitle: String! name: String! - description: String! + description: String status: ControlStatus! exclusionJustification: String } @@ -13524,7 +13524,7 @@ input UpdateControlInput { id: ID! sectionTitle: String name: String - description: String + description: String @goField(omittable: true) status: ControlStatus exclusionJustification: String } @@ -26564,14 +26564,11 @@ func (ec *executionContext) _Control_description(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Control_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -33282,14 +33279,11 @@ func (ec *executionContext) _Document_description(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Document_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -35984,14 +35978,11 @@ func (ec *executionContext) _Evidence_description(ctx context.Context, field gra return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Evidence_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -36995,14 +36986,11 @@ func (ec *executionContext) _Framework_description(ctx context.Context, field gr return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Framework_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -38889,14 +38877,11 @@ func (ec *executionContext) _Measure_description(ctx context.Context, field grap return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Measure_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -55403,14 +55388,11 @@ func (ec *executionContext) _Risk_description(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Risk_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -58991,14 +58973,11 @@ func (ec *executionContext) _Task_description(ctx context.Context, field graphql return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_Task_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -62523,14 +62502,11 @@ func (ec *executionContext) _TrustCenterReference_description(ctx context.Contex return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_TrustCenterReference_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -74042,7 +74018,7 @@ func (ec *executionContext) unmarshalInputCreateControlInput(ctx context.Context it.Name = data case "description": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) - data, err := ec.unmarshalNString2string(ctx, v) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } @@ -74371,7 +74347,7 @@ func (ec *executionContext) unmarshalInputCreateEvidenceInput(ctx context.Contex it.File = data case "description": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) - data, err := ec.unmarshalNString2string(ctx, v) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } @@ -74412,7 +74388,7 @@ func (ec *executionContext) unmarshalInputCreateFrameworkInput(ctx context.Conte it.Name = data case "description": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) - data, err := ec.unmarshalNString2string(ctx, v) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } @@ -74453,7 +74429,7 @@ func (ec *executionContext) unmarshalInputCreateMeasureInput(ctx context.Context it.Name = data case "description": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) - data, err := ec.unmarshalNString2string(ctx, v) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } @@ -74964,7 +74940,7 @@ func (ec *executionContext) unmarshalInputCreateRiskInput(ctx context.Context, o it.Name = data case "description": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) - data, err := ec.unmarshalNString2string(ctx, v) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } @@ -75309,7 +75285,7 @@ func (ec *executionContext) unmarshalInputCreateTaskInput(ctx context.Context, o it.Name = data case "description": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) - data, err := ec.unmarshalNString2string(ctx, v) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } @@ -75474,7 +75450,7 @@ func (ec *executionContext) unmarshalInputCreateTrustCenterReferenceInput(ctx co it.Name = data case "description": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) - data, err := ec.unmarshalNString2string(ctx, v) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } @@ -78219,7 +78195,7 @@ func (ec *executionContext) unmarshalInputRequestEvidenceInput(ctx context.Conte it.Type = data case "description": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("description")) - data, err := ec.unmarshalNString2string(ctx, v) + data, err := ec.unmarshalOString2ᚖstring(ctx, v) if err != nil { return it, err } @@ -78838,7 +78814,7 @@ func (ec *executionContext) unmarshalInputUpdateControlInput(ctx context.Context if err != nil { return it, err } - it.Description = data + it.Description = graphql.OmittableOf(data) case "status": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("status")) data, err := ec.unmarshalOControlStatus2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐControlStatus(ctx, v) @@ -79051,7 +79027,7 @@ func (ec *executionContext) unmarshalInputUpdateFrameworkInput(ctx context.Conte if err != nil { return it, err } - it.Description = data + it.Description = graphql.OmittableOf(data) } } @@ -79092,7 +79068,7 @@ func (ec *executionContext) unmarshalInputUpdateMeasureInput(ctx context.Context if err != nil { return it, err } - it.Description = data + it.Description = graphql.OmittableOf(data) case "category": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("category")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) @@ -79625,7 +79601,7 @@ func (ec *executionContext) unmarshalInputUpdateRiskInput(ctx context.Context, o if err != nil { return it, err } - it.Description = data + it.Description = graphql.OmittableOf(data) case "category": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("category")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) @@ -79840,7 +79816,7 @@ func (ec *executionContext) unmarshalInputUpdateTaskInput(ctx context.Context, o if err != nil { return it, err } - it.Description = data + it.Description = graphql.OmittableOf(data) case "state": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("state")) data, err := ec.unmarshalOTaskState2ᚖgoᚗproboᚗincᚋproboᚋpkgᚋcoredataᚐTaskState(ctx, v) @@ -80046,7 +80022,7 @@ func (ec *executionContext) unmarshalInputUpdateTrustCenterReferenceInput(ctx co if err != nil { return it, err } - it.Description = data + it.Description = graphql.OmittableOf(data) case "websiteUrl": ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("websiteUrl")) data, err := ec.unmarshalOString2ᚖstring(ctx, v) @@ -82585,9 +82561,6 @@ func (ec *executionContext) _Control(ctx context.Context, sel ast.SelectionSet, } case "description": out.Values[i] = ec._Control_description(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } case "status": out.Values[i] = ec._Control_status(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -86378,9 +86351,6 @@ func (ec *executionContext) _Document(ctx context.Context, sel ast.SelectionSet, } case "description": out.Values[i] = ec._Document_description(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } case "documentType": out.Values[i] = ec._Document_documentType(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -87304,9 +87274,6 @@ func (ec *executionContext) _Evidence(ctx context.Context, sel ast.SelectionSet, out.Values[i] = ec._Evidence_url(ctx, field, obj) case "description": out.Values[i] = ec._Evidence_description(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } case "task": field := field @@ -87734,9 +87701,6 @@ func (ec *executionContext) _Framework(ctx context.Context, sel ast.SelectionSet } case "description": out.Values[i] = ec._Framework_description(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } case "organization": field := field @@ -88542,9 +88506,6 @@ func (ec *executionContext) _Measure(ctx context.Context, sel ast.SelectionSet, } case "description": out.Values[i] = ec._Measure_description(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } case "state": out.Values[i] = ec._Measure_state(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -92617,9 +92578,6 @@ func (ec *executionContext) _Risk(ctx context.Context, sel ast.SelectionSet, obj } case "description": out.Values[i] = ec._Risk_description(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } case "category": out.Values[i] = ec._Risk_category(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -93767,9 +93725,6 @@ func (ec *executionContext) _Task(ctx context.Context, sel ast.SelectionSet, obj } case "description": out.Values[i] = ec._Task_description(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } case "state": out.Values[i] = ec._Task_state(ctx, field, obj) if out.Values[i] == graphql.Null { @@ -95176,9 +95131,6 @@ func (ec *executionContext) _TrustCenterReference(ctx context.Context, sel ast.S } case "description": out.Values[i] = ec._TrustCenterReference_description(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } case "websiteUrl": out.Values[i] = ec._TrustCenterReference_websiteUrl(ctx, field, obj) if out.Values[i] == graphql.Null { diff --git a/pkg/server/api/console/v1/types/types.go b/pkg/server/api/console/v1/types/types.go index 4dee12e5d..b5d4c8f2a 100644 --- a/pkg/server/api/console/v1/types/types.go +++ b/pkg/server/api/console/v1/types/types.go @@ -178,7 +178,7 @@ type Control struct { ID gid.GID `json:"id"` SectionTitle string `json:"sectionTitle"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` Status coredata.ControlStatus `json:"status"` ExclusionJustification *string `json:"exclusionJustification,omitempty"` Framework *Framework `json:"framework"` @@ -269,7 +269,7 @@ type CreateControlInput struct { FrameworkID gid.GID `json:"frameworkId"` SectionTitle string `json:"sectionTitle"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` Status coredata.ControlStatus `json:"status"` ExclusionJustification *string `json:"exclusionJustification,omitempty"` } @@ -348,7 +348,7 @@ type CreateEvidenceInput struct { Type coredata.EvidenceType `json:"type"` URL *string `json:"url,omitempty"` File *graphql.Upload `json:"file,omitempty"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` } type CreateEvidencePayload struct { @@ -358,7 +358,7 @@ type CreateEvidencePayload struct { type CreateFrameworkInput struct { OrganizationID gid.GID `json:"organizationId"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` } type CreateFrameworkPayload struct { @@ -368,7 +368,7 @@ type CreateFrameworkPayload struct { type CreateMeasureInput struct { OrganizationID gid.GID `json:"organizationId"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` Category string `json:"category"` } @@ -471,7 +471,7 @@ type CreateRiskDocumentMappingPayload struct { type CreateRiskInput struct { OrganizationID gid.GID `json:"organizationId"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` Category string `json:"category"` OwnerID *gid.GID `json:"ownerId,omitempty"` Treatment coredata.RiskTreatment `json:"treatment"` @@ -543,7 +543,7 @@ type CreateTaskInput struct { OrganizationID gid.GID `json:"organizationId"` MeasureID *gid.GID `json:"measureId,omitempty"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` TimeEstimate *time.Duration `json:"timeEstimate,omitempty"` AssignedToID *gid.GID `json:"assignedToId,omitempty"` Deadline *time.Time `json:"deadline,omitempty"` @@ -579,7 +579,7 @@ type CreateTrustCenterFilePayload struct { type CreateTrustCenterReferenceInput struct { TrustCenterID gid.GID `json:"trustCenterId"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` WebsiteURL string `json:"websiteUrl"` LogoFile graphql.Upload `json:"logoFile"` } @@ -1042,7 +1042,7 @@ type DisableSAMLPayload struct { type Document struct { ID gid.GID `json:"id"` Title string `json:"title"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` DocumentType coredata.DocumentType `json:"documentType"` Classification coredata.DocumentClassification `json:"classification"` CurrentPublishedVersion *int `json:"currentPublishedVersion,omitempty"` @@ -1148,7 +1148,7 @@ type Evidence struct { Type coredata.EvidenceType `json:"type"` File *File `json:"file,omitempty"` URL *string `json:"url,omitempty"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` Task *Task `json:"task,omitempty"` Measure *Measure `json:"measure"` CreatedAt time.Time `json:"createdAt"` @@ -1195,7 +1195,7 @@ type File struct { type Framework struct { ID gid.GID `json:"id"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` Organization *Organization `json:"organization"` Controls *ControlConnection `json:"controls"` CreatedAt time.Time `json:"createdAt"` @@ -1317,7 +1317,7 @@ type Measure struct { ID gid.GID `json:"id"` Category string `json:"category"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` State coredata.MeasureState `json:"state"` Evidences *EvidenceConnection `json:"evidences"` Tasks *TaskConnection `json:"tasks"` @@ -1587,7 +1587,7 @@ type RequestEvidenceInput struct { TaskID gid.GID `json:"taskId"` Name string `json:"name"` Type coredata.EvidenceType `json:"type"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` } type RequestEvidencePayload struct { @@ -1607,7 +1607,7 @@ type Risk struct { ID gid.GID `json:"id"` SnapshotID *gid.GID `json:"snapshotId,omitempty"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` Category string `json:"category"` Treatment coredata.RiskTreatment `json:"treatment"` InherentLikelihood int `json:"inherentLikelihood"` @@ -1721,7 +1721,7 @@ type SnapshotEdge struct { type Task struct { ID gid.GID `json:"id"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` State coredata.TaskState `json:"state"` TimeEstimate *time.Duration `json:"timeEstimate,omitempty"` Deadline *time.Time `json:"deadline,omitempty"` @@ -1820,7 +1820,7 @@ type TrustCenterFileEdge struct { type TrustCenterReference struct { ID gid.GID `json:"id"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` WebsiteURL string `json:"websiteUrl"` LogoURL string `json:"logoUrl"` Rank int `json:"rank"` @@ -1887,12 +1887,12 @@ type UpdateContinualImprovementPayload struct { } type UpdateControlInput struct { - ID gid.GID `json:"id"` - SectionTitle *string `json:"sectionTitle,omitempty"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Status *coredata.ControlStatus `json:"status,omitempty"` - ExclusionJustification *string `json:"exclusionJustification,omitempty"` + ID gid.GID `json:"id"` + SectionTitle *string `json:"sectionTitle,omitempty"` + Name *string `json:"name,omitempty"` + Description graphql.Omittable[*string] `json:"description,omitempty"` + Status *coredata.ControlStatus `json:"status,omitempty"` + ExclusionJustification *string `json:"exclusionJustification,omitempty"` } type UpdateControlPayload struct { @@ -1935,9 +1935,9 @@ type UpdateDocumentVersionPayload struct { } type UpdateFrameworkInput struct { - ID gid.GID `json:"id"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` + ID gid.GID `json:"id"` + Name *string `json:"name,omitempty"` + Description graphql.Omittable[*string] `json:"description,omitempty"` } type UpdateFrameworkPayload struct { @@ -1945,11 +1945,11 @@ type UpdateFrameworkPayload struct { } type UpdateMeasureInput struct { - ID gid.GID `json:"id"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - Category *string `json:"category,omitempty"` - State *coredata.MeasureState `json:"state,omitempty"` + ID gid.GID `json:"id"` + Name *string `json:"name,omitempty"` + Description graphql.Omittable[*string] `json:"description,omitempty"` + Category *string `json:"category,omitempty"` + State *coredata.MeasureState `json:"state,omitempty"` } type UpdateMeasurePayload struct { @@ -2048,7 +2048,7 @@ type UpdateProcessingActivityPayload struct { type UpdateRiskInput struct { ID gid.GID `json:"id"` Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` + Description graphql.Omittable[*string] `json:"description,omitempty"` Category *string `json:"category,omitempty"` OwnerID graphql.Omittable[*gid.GID] `json:"ownerId,omitempty"` Treatment *coredata.RiskTreatment `json:"treatment,omitempty"` @@ -2087,7 +2087,7 @@ type UpdateSAMLConfigurationPayload struct { type UpdateTaskInput struct { TaskID gid.GID `json:"taskId"` Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` + Description graphql.Omittable[*string] `json:"description,omitempty"` State *coredata.TaskState `json:"state,omitempty"` TimeEstimate graphql.Omittable[*time.Duration] `json:"timeEstimate,omitempty"` Deadline graphql.Omittable[*time.Time] `json:"deadline,omitempty"` @@ -2131,12 +2131,12 @@ type UpdateTrustCenterPayload struct { } type UpdateTrustCenterReferenceInput struct { - ID gid.GID `json:"id"` - Name *string `json:"name,omitempty"` - Description *string `json:"description,omitempty"` - WebsiteURL *string `json:"websiteUrl,omitempty"` - LogoFile *graphql.Upload `json:"logoFile,omitempty"` - Rank *int `json:"rank,omitempty"` + ID gid.GID `json:"id"` + Name *string `json:"name,omitempty"` + Description graphql.Omittable[*string] `json:"description,omitempty"` + WebsiteURL *string `json:"websiteUrl,omitempty"` + LogoFile *graphql.Upload `json:"logoFile,omitempty"` + Rank *int `json:"rank,omitempty"` } type UpdateTrustCenterReferencePayload struct { diff --git a/pkg/server/api/console/v1/v1_resolver.go b/pkg/server/api/console/v1/v1_resolver.go index 943ea2598..0ba58c57d 100644 --- a/pkg/server/api/console/v1/v1_resolver.go +++ b/pkg/server/api/console/v1/v1_resolver.go @@ -1487,7 +1487,7 @@ func (r *mutationResolver) UpdateTrustCenterReference(ctx context.Context, input req := &probo.UpdateTrustCenterReferenceRequest{ ID: input.ID, Name: input.Name, - Description: input.Description, + Description: UnwrapOmittable(input.Description), WebsiteURL: input.WebsiteURL, Rank: input.Rank, } @@ -1971,7 +1971,7 @@ func (r *mutationResolver) UpdateFramework(ctx context.Context, input types.Upda framework, err := prb.Frameworks.Update(ctx, probo.UpdateFrameworkRequest{ ID: input.ID, Name: input.Name, - Description: input.Description, + Description: UnwrapOmittable(input.Description), }) if err != nil { return nil, fmt.Errorf("cannot update framework: %w", err) @@ -2096,7 +2096,7 @@ func (r *mutationResolver) UpdateControl(ctx context.Context, input types.Update control, err := prb.Controls.Update(ctx, probo.UpdateControlRequest{ ID: input.ID, Name: input.Name, - Description: input.Description, + Description: UnwrapOmittable(input.Description), SectionTitle: input.SectionTitle, Status: input.Status, ExclusionJustification: input.ExclusionJustification, @@ -2159,7 +2159,7 @@ func (r *mutationResolver) UpdateMeasure(ctx context.Context, input types.Update measure, err := prb.Measures.Update(ctx, probo.UpdateMeasureRequest{ ID: input.ID, Name: input.Name, - Description: input.Description, + Description: UnwrapOmittable(input.Description), Category: input.Category, State: input.State, }) @@ -2366,7 +2366,7 @@ func (r *mutationResolver) UpdateTask(ctx context.Context, input types.UpdateTas task, err := prb.Tasks.Update(ctx, probo.UpdateTaskRequest{ TaskID: input.TaskID, Name: input.Name, - Description: input.Description, + Description: UnwrapOmittable(input.Description), State: input.State, TimeEstimate: UnwrapOmittable(input.TimeEstimate), Deadline: UnwrapOmittable(input.Deadline), @@ -2464,7 +2464,7 @@ func (r *mutationResolver) UpdateRisk(ctx context.Context, input types.UpdateRis probo.UpdateRiskRequest{ ID: input.ID, Name: input.Name, - Description: input.Description, + Description: UnwrapOmittable(input.Description), Category: input.Category, Treatment: input.Treatment, OwnerID: UnwrapOmittable(input.OwnerID), diff --git a/pkg/server/api/trust/v1/schema.graphql b/pkg/server/api/trust/v1/schema.graphql index 482a99d3b..07436d699 100644 --- a/pkg/server/api/trust/v1/schema.graphql +++ b/pkg/server/api/trust/v1/schema.graphql @@ -461,7 +461,7 @@ type VendorEdge { type TrustCenterReference implements Node { id: ID! name: String! - description: String! + description: String websiteUrl: String! logoUrl: String! @goField(forceResolver: true) } diff --git a/pkg/server/api/trust/v1/schema/schema.go b/pkg/server/api/trust/v1/schema/schema.go index 24d03a899..d27f4bc5a 100644 --- a/pkg/server/api/trust/v1/schema/schema.go +++ b/pkg/server/api/trust/v1/schema/schema.go @@ -1624,7 +1624,7 @@ type VendorEdge { type TrustCenterReference implements Node { id: ID! name: String! - description: String! + description: String websiteUrl: String! logoUrl: String! @goField(forceResolver: true) } @@ -6809,14 +6809,11 @@ func (ec *executionContext) _TrustCenterReference_description(ctx context.Contex return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } func (ec *executionContext) fieldContext_TrustCenterReference_description(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { @@ -11683,9 +11680,6 @@ func (ec *executionContext) _TrustCenterReference(ctx context.Context, sel ast.S } case "description": out.Values[i] = ec._TrustCenterReference_description(ctx, field, obj) - if out.Values[i] == graphql.Null { - atomic.AddUint32(&out.Invalids, 1) - } case "websiteUrl": out.Values[i] = ec._TrustCenterReference_websiteUrl(ctx, field, obj) if out.Values[i] == graphql.Null { diff --git a/pkg/server/api/trust/v1/types/types.go b/pkg/server/api/trust/v1/types/types.go index 9e98f4fd4..73b978c90 100644 --- a/pkg/server/api/trust/v1/types/types.go +++ b/pkg/server/api/trust/v1/types/types.go @@ -220,7 +220,7 @@ type TrustCenterFileEdge struct { type TrustCenterReference struct { ID gid.GID `json:"id"` Name string `json:"name"` - Description string `json:"description"` + Description *string `json:"description,omitempty"` WebsiteURL string `json:"websiteUrl"` LogoURL string `json:"logoUrl"` }