-
-
Notifications
You must be signed in to change notification settings - Fork 735
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move project owner read model to personal dashboard service
- Loading branch information
1 parent
846e16f
commit 3f20ed5
Showing
4 changed files
with
27 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 19 additions & 4 deletions
23
src/lib/features/personal-dashboard/personal-dashboard-service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,36 @@ | ||
import type { IProjectOwnersReadModel } from '../project/project-owners-read-model.type'; | ||
import type { | ||
IPersonalDashboardReadModel, | ||
PersonalFeature, | ||
PersonalProject, | ||
PersonalProjectWithOwners, | ||
} from './personal-dashboard-read-model-type'; | ||
|
||
export class PersonalDashboardService { | ||
private personalDashboardReadModel: IPersonalDashboardReadModel; | ||
|
||
constructor(personalDashboardReadModel: IPersonalDashboardReadModel) { | ||
private projectOwnersReadModel: IProjectOwnersReadModel; | ||
|
||
constructor( | ||
personalDashboardReadModel: IPersonalDashboardReadModel, | ||
projectOwnersReadModel: IProjectOwnersReadModel, | ||
) { | ||
this.personalDashboardReadModel = personalDashboardReadModel; | ||
this.projectOwnersReadModel = projectOwnersReadModel; | ||
} | ||
|
||
getPersonalFeatures(userId: number): Promise<PersonalFeature[]> { | ||
return this.personalDashboardReadModel.getPersonalFeatures(userId); | ||
} | ||
|
||
getPersonalProjects(userId: number): Promise<PersonalProject[]> { | ||
return this.personalDashboardReadModel.getPersonalProjects(userId); | ||
async getPersonalProjects( | ||
userId: number, | ||
): Promise<PersonalProjectWithOwners[]> { | ||
const projects = | ||
await this.personalDashboardReadModel.getPersonalProjects(userId); | ||
|
||
const withOwners = | ||
await this.projectOwnersReadModel.addOwners(projects); | ||
|
||
return withOwners; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters