-
-
Notifications
You must be signed in to change notification settings - Fork 669
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: project owners in project service (#6935)
Schema and integrating into service and controller for project owners --------- Co-authored-by: Thomas Heartman <thomas@getunleash.io>
- Loading branch information
1 parent
7d01dbb
commit 66ec9a2
Showing
11 changed files
with
189 additions
and
48 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
16 changes: 16 additions & 0 deletions
16
src/lib/features/project/fake-project-owners-read-model.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { IProjectWithCount } from '../../types'; | ||
import type { | ||
IProjectOwnersReadModel, | ||
IProjectWithCountAndOwners, | ||
} from './project-owners-read-model.type'; | ||
|
||
export class FakeProjectOwnersReadModel implements IProjectOwnersReadModel { | ||
async addOwners( | ||
projects: IProjectWithCount[], | ||
): Promise<IProjectWithCountAndOwners[]> { | ||
return projects.map((project) => ({ | ||
...project, | ||
owners: [{ ownerType: 'system' }], | ||
})); | ||
} | ||
} |
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
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
28 changes: 28 additions & 0 deletions
28
src/lib/features/project/project-owners-read-model.type.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { IProjectWithCount } from '../../types'; | ||
|
||
export type SystemOwner = { ownerType: 'system' }; | ||
export type UserProjectOwner = { | ||
ownerType: 'user'; | ||
name: string; | ||
email?: string; | ||
imageUrl?: string; | ||
}; | ||
export type GroupProjectOwner = { | ||
ownerType: 'group'; | ||
name: string; | ||
}; | ||
type ProjectOwners = | ||
| [SystemOwner] | ||
| Array<UserProjectOwner | GroupProjectOwner>; | ||
|
||
export type ProjectOwnersDictionary = Record<string, ProjectOwners>; | ||
|
||
export type IProjectWithCountAndOwners = IProjectWithCount & { | ||
owners: ProjectOwners; | ||
}; | ||
|
||
export interface IProjectOwnersReadModel { | ||
addOwners( | ||
projects: IProjectWithCount[], | ||
): Promise<IProjectWithCountAndOwners[]>; | ||
} |
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
Oops, something went wrong.