mirror of
https://github.com/Unleash/unleash.git
synced 2025-03-18 00:19:49 +01:00
This PR is part 1 of returning project owners and your project roles for the personal dashboard single-project endpoint. It moves the responsibility of adding owners and roles to the project to the service from the controller and adds a new method to the project owners read model to take care of it. I'll add roles and tests in follow-up PRs.
26 lines
647 B
TypeScript
26 lines
647 B
TypeScript
import type {
|
|
IProjectOwnersReadModel,
|
|
ProjectOwners,
|
|
UserProjectOwner,
|
|
WithProjectOwners,
|
|
} from './project-owners-read-model.type';
|
|
|
|
export class FakeProjectOwnersReadModel implements IProjectOwnersReadModel {
|
|
async addOwners<T extends { id: string }>(
|
|
projects: T[],
|
|
): Promise<WithProjectOwners<T>> {
|
|
return projects.map((project) => ({
|
|
...project,
|
|
owners: [{ ownerType: 'system' }],
|
|
}));
|
|
}
|
|
|
|
async getAllUserProjectOwners(): Promise<UserProjectOwner[]> {
|
|
return [];
|
|
}
|
|
|
|
async getProjectOwners(): Promise<ProjectOwners> {
|
|
return [];
|
|
}
|
|
}
|