From 5103f265f170b9f76b7f3052c972bcd152990465 Mon Sep 17 00:00:00 2001 From: Mohamed-Hacene Date: Mon, 16 Sep 2024 17:43:28 +0200 Subject: [PATCH] chore: run format --- .../src/lib/components/SideBar/navData.ts | 6 +---- frontend/src/lib/utils/crud.ts | 5 +++- frontend/src/lib/utils/schemas.ts | 2 +- .../[id=uuid]/table-mode/+page.server.ts | 23 +++++++++++-------- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/frontend/src/lib/components/SideBar/navData.ts b/frontend/src/lib/components/SideBar/navData.ts index 74db12261..baa13b253 100644 --- a/frontend/src/lib/components/SideBar/navData.ts +++ b/frontend/src/lib/components/SideBar/navData.ts @@ -30,11 +30,7 @@ export const navData = { name: 'calendar', fa_icon: 'fa-solid fa-calendar-days', href: '/calendar', - permissions: [ - 'view_appliedcontrol', - 'view_riskacceptance', - 'view_riskassessment', - ] + permissions: ['view_appliedcontrol', 'view_riskacceptance', 'view_riskassessment'] } ] }, diff --git a/frontend/src/lib/utils/crud.ts b/frontend/src/lib/utils/crud.ts index 8322e668c..fc92abb7d 100644 --- a/frontend/src/lib/utils/crud.ts +++ b/frontend/src/lib/utils/crud.ts @@ -146,7 +146,10 @@ export const URL_MODEL_MAP: ModelMap = { verboseNamePlural: 'Domains', listViewUrlParams: '?content_type=DO&content_type=GL', foreignKeyFields: [{ field: 'parent_folder', urlModel: 'folders' }], - reverseForeignKeyFields: [{ field: 'folder', urlModel: 'projects' }, { field: 'folder', urlModel: 'entities' }] + reverseForeignKeyFields: [ + { field: 'folder', urlModel: 'projects' }, + { field: 'folder', urlModel: 'entities' } + ] }, projects: { name: 'project', diff --git a/frontend/src/lib/utils/schemas.ts b/frontend/src/lib/utils/schemas.ts index 967b05bda..176d1e429 100644 --- a/frontend/src/lib/utils/schemas.ts +++ b/frontend/src/lib/utils/schemas.ts @@ -321,7 +321,7 @@ export const representativeSchema = z.object({ last_name: z.string().optional(), phone: z.string().optional(), role: z.string().optional(), - description: z.string().optional(), + description: z.string().optional() }); const SCHEMA_MAP: Record = { diff --git a/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/table-mode/+page.server.ts b/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/table-mode/+page.server.ts index 8d4a26b7a..5546c3948 100644 --- a/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/table-mode/+page.server.ts +++ b/frontend/src/routes/(app)/compliance-assessments/[id=uuid]/table-mode/+page.server.ts @@ -46,16 +46,19 @@ export const load = (async ({ fetch, params }) => { }) ); - const requirementAssessmentsById = requirement_assessments.reduce((acc, requirementAssessment) => { - acc[requirementAssessment.requirement] = requirementAssessment; - return acc; - }, {}); - - const requirements = tableMode.requirements.map(requirement => { - if (requirementAssessmentsById[requirement.id]) { - return requirementAssessmentsById[requirement.id] - } - return requirement; + const requirementAssessmentsById = requirement_assessments.reduce( + (acc, requirementAssessment) => { + acc[requirementAssessment.requirement] = requirementAssessment; + return acc; + }, + {} + ); + + const requirements = tableMode.requirements.map((requirement) => { + if (requirementAssessmentsById[requirement.id]) { + return requirementAssessmentsById[requirement.id]; + } + return requirement; }); const schema = z.object({ id: z.string().uuid() });