ProjectLifecycle: the mechanism ProjectService implements.
API
@Interface()
export abstract class ProjectLifecycle {
abstract requireProjectAccess(
userId: string,
projectId: string,
): ProjectRow & { role: ProjectRole };
abstract canAccess(userId: string, projectId: string): boolean;
abstract requireProjectOwner(userId: string, projectId: string): ProjectRow;
abstract accessibleProjectIds(userId: string): string[];
abstract listProjects(userId: string): Promise<ProjectSummary[]>;
abstract createProject(owner: UserRow, projectId: string, name?: string): Promise<ProjectSummary>;
abstract takenProjectIds(): Promise<string[]>;
abstract provisionInitialProject(user: UserRow, isAdmin: boolean): Promise<void>;
abstract renameProject(userId: string, projectId: string, name: string): Promise<ProjectSummary>;
abstract deleteProject(userId: string, projectId: string): Promise<void>;
abstract destroyProject(projectId: string): Promise<void>;
abstract listMembers(userId: string, projectId: string): MemberInfo[];
abstract addMember(userId: string, projectId: string, targetUserId: string): MemberInfo;
abstract removeMember(userId: string, projectId: string, targetUserId: string): void;
}Contract Topology
Static AST wiring across @Module / @Provide / @UseMembers (14)
requireProjectAccess
requireProjectAccess(userId: string, projectId: string): ProjectRow & { role: ProjectRole }@paramuserId
string@paramprojectId
string@returns
ProjectRow & { role: ProjectRole }canAccess
canAccess(userId: string, projectId: string): boolean@paramuserId
string@paramprojectId
string@returns
booleanrequireProjectOwner
requireProjectOwner(userId: string, projectId: string): ProjectRow@paramuserId
string@paramprojectId
string@returns
ProjectRowaccessibleProjectIds
accessibleProjectIds(userId: string): string[]@paramuserId
string@returns
string[]listProjects
listProjects(userId: string): Promise<ProjectSummary[]>@paramuserId
string@returns
Promise<ProjectSummary[]>createProject
createProject(owner: UserRow, projectId: string, name?: string): Promise<ProjectSummary>@paramowner
UserRow@paramprojectId
string@paramname?
string@returns
Promise<ProjectSummary>takenProjectIds
takenProjectIds(): Promise<string[]>Every id createProject refuses as taken, as names only: the rows and the data root's entries.
@returns
Promise<string[]>provisionInitialProject
provisionInitialProject(user: UserRow, isAdmin: boolean): Promise<void>@paramuser
UserRow@paramisAdmin
boolean@returns
Promise<void>renameProject
renameProject(userId: string, projectId: string, name: string): Promise<ProjectSummary>@paramuserId
string@paramprojectId
string@paramname
string@returns
Promise<ProjectSummary>deleteProject
deleteProject(userId: string, projectId: string): Promise<void>@paramuserId
string@paramprojectId
string@returns
Promise<void>destroyProject
destroyProject(projectId: string): Promise<void>@paramprojectId
string@returns
Promise<void>listMembers
listMembers(userId: string, projectId: string): MemberInfo[]@paramuserId
string@paramprojectId
string@returns
MemberInfo[]addMember
addMember(userId: string, projectId: string, targetUserId: string): MemberInfo@paramuserId
string@paramprojectId
string@paramtargetUserId
string@returns
MemberInforemoveMember
removeMember(userId: string, projectId: string, targetUserId: string): void@paramuserId
string@paramprojectId
string@paramtargetUserId
string@returns
void