From 328de1bda96812395d66e1d83fe7c23136ae4cd8 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Wed, 25 Sep 2024 10:10:46 +0200 Subject: [PATCH] feat: fix more types --- .../personal-dashboard-read-model.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/features/personal-dashboard/personal-dashboard-read-model.ts b/src/lib/features/personal-dashboard/personal-dashboard-read-model.ts index aaf97031da4a..9225a96f5433 100644 --- a/src/lib/features/personal-dashboard/personal-dashboard-read-model.ts +++ b/src/lib/features/personal-dashboard/personal-dashboard-read-model.ts @@ -5,6 +5,12 @@ import type { PersonalProject, } from './personal-dashboard-read-model-type'; +type IntermediateProjectResult = Omit & { + roles: { + [id: number]: { id: number; name: string; type: string }; + }; +}; + export class PersonalDashboardReadModel implements IPersonalDashboardReadModel { private db: Db; @@ -71,13 +77,13 @@ export class PersonalDashboardReadModel implements IPersonalDashboardReadModel { }, {}); const projectList: PersonalProject[] = Object.values(dict).map( - (project) => { + (project: IntermediateProjectResult) => { const roles = Object.values(project.roles); roles.sort((a, b) => a.id - b.id); return { ...project, roles, - }; + } as PersonalProject; }, ); projectList.sort((a, b) => a.name.localeCompare(b.name));