Make descriptions nullable

Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
Sacha Al Himdani
2025-11-05 16:48:58 +01:00
parent 637f097cc6
commit 288c59a5f2
60 changed files with 311 additions and 375 deletions

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<ac10f3fa76fc76951f4c08e38ef0a185>>
* @generated SignedSource<<b39754dc6d5d5f02e4310f0db334add3>>
* @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;

View File

@@ -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,

View File

@@ -38,7 +38,7 @@ type Props = {
id: string;
name: string;
state: "TODO" | "DONE";
description: string;
description?: string | null;
measure?: {
id: string;
name: string;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<beed7398f44a7093301b72d7bceeeba1>>
* @generated SignedSource<<c196829e8365168f07614d741242296c>>
* @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;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<d6d04868c777f81982de3bffb9a7e73f>>
* @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;

View File

@@ -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<TrustCenterReferenceDialogR
setUploadedFile(null);
reset({
name: reference.name,
description: reference.description,
description: reference.description ?? undefined,
websiteUrl: reference.websiteUrl,
rank: reference.rank,
});
@@ -116,7 +116,7 @@ export const TrustCenterReferenceDialog = forwardRef<TrustCenterReferenceDialogR
input: {
trustCenterId,
name: data.name,
description: data.description,
description: data.description || null,
websiteUrl: data.websiteUrl,
logoFile: null,
},
@@ -135,14 +135,14 @@ export const TrustCenterReferenceDialog = forwardRef<TrustCenterReferenceDialogR
const input: {
id: string;
name: string;
description: string;
description: string | null;
websiteUrl: string;
rank?: number;
logoFile?: null;
} = {
id: editReference.id,
name: data.name,
description: data.description,
description: data.description || null,
websiteUrl: data.websiteUrl,
};

View File

@@ -30,7 +30,7 @@ type Props = {
type Reference = {
id: string;
name: string;
description: string;
description?: string | null;
websiteUrl: string;
logoUrl: string;
rank: number;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<828d1e2364b7b8c540508d9fb7104b06>>
* @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;

View File

@@ -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,
}
: {

View File

@@ -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(() => {

View File

@@ -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<{

View File

@@ -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;
};

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<f3eadb5ecfeb7b2304712f74b6ac8863>>
* @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;
};

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<285497dfb150c3f02c055a091769f301>>
* @generated SignedSource<<bfffdd69a2b1f565b60beee5e96d430a>>
* @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;

View File

@@ -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;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<85556d15b776b3e61e312057a994d482>>
* @generated SignedSource<<e7776b4ead5bff52ce340c208ec5bbc6>>
* @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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<f6a6c2f623522098263a3b556d3c3658>>
* @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: {

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<e853bbeba41d33327ee6612c84e21297>>
* @generated SignedSource<<f772c53b0007859aecc59a9484b5b791>>
* @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: {

View File

@@ -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")}
/>
</div>

View File

@@ -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")}
/>

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<c6e55821a322dceae5408ac3898cfa48>>
* @generated SignedSource<<daf4012a65afffdedc10e4f5c7e2bc3c>>
* @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: {

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<ec6bd0c6fff930b82216d940e83d8ef0>>
* @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";

View File

@@ -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,

View File

@@ -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],

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<be64518840fd2564cffe1646a58c3762>>
* @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;

View File

@@ -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;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<fef15c2f99a731cf6c49a99487e37c59>>
* @generated SignedSource<<b8d5c939f1b3a4337be9a4ecc2e8fd98>>
* @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;
};

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<530c955a326f52f3c668e9f43788a54f>>
* @generated SignedSource<<d60cc1832963c81fe19cfe8a71992273>>
* @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;
};

View File

@@ -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
/>
</div>
{/* Properties form */}

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<09acdf5a03dd4ad1fab64c2c08564a2a>>
* @generated SignedSource<<a1cf7f654fe2f662c446e60ce82e3ae9>>
* @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;
};

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<ad3cb8a5e721cd1d83d80540320b8313>>
* @generated SignedSource<<d4866432b6b5c9e71e6e4893062c1809>>
* @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;

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<67fd0b26613189fa036f7873138787d7>>
* @generated SignedSource<<cfddd118e2b6db135ad87fe157c89151>>
* @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;

View File

@@ -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!],

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<66f4e8603a811d1fb363ae88ea697b22>>
* @generated SignedSource<<dfc4b37cf499f7cb24c0b1bd1eec3b11>>
* @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;

View File

@@ -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;