Skip to content

Commit

Permalink
feat: fix more types
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheartman committed Sep 25, 2024
1 parent d4d4a9e commit 328de1b
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import type {
PersonalProject,
} from './personal-dashboard-read-model-type';

type IntermediateProjectResult = Omit<PersonalProject, 'roles'> & {
roles: {
[id: number]: { id: number; name: string; type: string };
};
};

export class PersonalDashboardReadModel implements IPersonalDashboardReadModel {
private db: Db;

Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 328de1b

Please sign in to comment.