generated from bastian/boilerplate
mvp
This commit is contained in:
@@ -26,7 +26,8 @@ export type Permission =
|
||||
| 'sessions.manage'
|
||||
| 'notifications.readOwn'
|
||||
| 'notifications.updateOwn'
|
||||
| 'notifications.manage';
|
||||
| 'notifications.manage'
|
||||
| 'projects.use';
|
||||
|
||||
export interface ApiErrorBody {
|
||||
status: number;
|
||||
@@ -47,6 +48,7 @@ export interface UserDto {
|
||||
id: string;
|
||||
name: string;
|
||||
email: string | null;
|
||||
emailVerified: boolean | null;
|
||||
active: boolean;
|
||||
lastLoginAt: string | null;
|
||||
roles: RoleDto[];
|
||||
@@ -97,6 +99,40 @@ export interface RoleDto {
|
||||
users?: UserDto[];
|
||||
}
|
||||
|
||||
export type ProjectRole = 'owner' | 'administrator' | 'editor' | 'reader';
|
||||
|
||||
export interface ProjectDto {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
role: ProjectRole;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface ProjectMemberDto {
|
||||
userId: string;
|
||||
name: string;
|
||||
email: string | null;
|
||||
role: ProjectRole;
|
||||
active: boolean;
|
||||
joinedAt: string;
|
||||
}
|
||||
|
||||
export interface ProjectInvitationDto {
|
||||
id: string;
|
||||
projectId: string | null;
|
||||
projectName: string | null;
|
||||
role: ProjectRole;
|
||||
status: 'pending' | 'accepted' | 'declined' | 'revoked' | 'expired';
|
||||
invitedEmailMasked: string;
|
||||
expiresAt: string;
|
||||
mailStatus: 'not_configured';
|
||||
canRespond: boolean;
|
||||
reason: 'email_mismatch' | 'email_unverified' | null;
|
||||
invitationPath?: string;
|
||||
}
|
||||
|
||||
export interface ItemDto {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -140,7 +176,8 @@ export type NotificationType =
|
||||
| 'system'
|
||||
| 'item.created'
|
||||
| 'item.updated'
|
||||
| 'user.role-changed';
|
||||
| 'user.role-changed'
|
||||
| 'project.invitation';
|
||||
|
||||
export type NotificationStatusFilter = 'all' | 'read' | 'unread';
|
||||
|
||||
@@ -188,6 +225,10 @@ import type {
|
||||
NotificationStatusFilter,
|
||||
PageDto,
|
||||
Permission,
|
||||
ProjectDto,
|
||||
ProjectInvitationDto,
|
||||
ProjectMemberDto,
|
||||
ProjectRole,
|
||||
RoleDto,
|
||||
SaveItemDto,
|
||||
SessionDto,
|
||||
@@ -226,6 +267,106 @@ export class ApiClientService {
|
||||
}>(\`\${this.base}/dashboard\`, { withCredentials: true });
|
||||
}
|
||||
|
||||
projects(): Observable<ProjectDto[]> {
|
||||
return this.http.get<ProjectDto[]>(\`\${this.base}/projects\`, {
|
||||
withCredentials: true,
|
||||
});
|
||||
}
|
||||
|
||||
project(id: string): Observable<ProjectDto> {
|
||||
return this.http.get<ProjectDto>(\`\${this.base}/projects/\${id}\`, {
|
||||
withCredentials: true,
|
||||
});
|
||||
}
|
||||
|
||||
createProject(body: { name: string; description?: string }): Observable<ProjectDto> {
|
||||
return this.http.post<ProjectDto>(\`\${this.base}/projects\`, body, {
|
||||
withCredentials: true,
|
||||
});
|
||||
}
|
||||
|
||||
projectMembers(projectId: string): Observable<ProjectMemberDto[]> {
|
||||
return this.http.get<ProjectMemberDto[]>(
|
||||
\`\${this.base}/projects/\${projectId}/members\`,
|
||||
{ withCredentials: true },
|
||||
);
|
||||
}
|
||||
|
||||
updateProjectMember(
|
||||
projectId: string,
|
||||
userId: string,
|
||||
role: ProjectRole,
|
||||
): Observable<ProjectMemberDto> {
|
||||
return this.http.patch<ProjectMemberDto>(
|
||||
\`\${this.base}/projects/\${projectId}/members/\${userId}\`,
|
||||
{ role },
|
||||
{ withCredentials: true },
|
||||
);
|
||||
}
|
||||
|
||||
removeProjectMember(projectId: string, userId: string): Observable<void> {
|
||||
return this.http.delete<void>(
|
||||
\`\${this.base}/projects/\${projectId}/members/\${userId}\`,
|
||||
{ withCredentials: true },
|
||||
);
|
||||
}
|
||||
|
||||
createProjectInvitation(
|
||||
projectId: string,
|
||||
body: { email: string; role: ProjectRole },
|
||||
): Observable<ProjectInvitationDto> {
|
||||
return this.http.post<ProjectInvitationDto>(
|
||||
\`\${this.base}/projects/\${projectId}/invitations\`,
|
||||
body,
|
||||
{ withCredentials: true },
|
||||
);
|
||||
}
|
||||
|
||||
pendingProjectInvitations(): Observable<ProjectInvitationDto[]> {
|
||||
return this.http.get<ProjectInvitationDto[]>(\`\${this.base}/invitations\`, {
|
||||
withCredentials: true,
|
||||
});
|
||||
}
|
||||
|
||||
acceptPendingProjectInvitation(invitationId: string): Observable<ProjectDto> {
|
||||
return this.http.post<ProjectDto>(
|
||||
\`\${this.base}/invitations/by-id/\${invitationId}/accept\`,
|
||||
{},
|
||||
{ withCredentials: true },
|
||||
);
|
||||
}
|
||||
|
||||
declinePendingProjectInvitation(invitationId: string): Observable<void> {
|
||||
return this.http.post<void>(
|
||||
\`\${this.base}/invitations/by-id/\${invitationId}/decline\`,
|
||||
{},
|
||||
{ withCredentials: true },
|
||||
);
|
||||
}
|
||||
|
||||
projectInvitation(token: string): Observable<ProjectInvitationDto> {
|
||||
return this.http.get<ProjectInvitationDto>(
|
||||
\`\${this.base}/invitations/\${encodeURIComponent(token)}\`,
|
||||
{ withCredentials: true },
|
||||
);
|
||||
}
|
||||
|
||||
acceptProjectInvitation(token: string): Observable<ProjectDto> {
|
||||
return this.http.post<ProjectDto>(
|
||||
\`\${this.base}/invitations/\${encodeURIComponent(token)}/accept\`,
|
||||
{},
|
||||
{ withCredentials: true },
|
||||
);
|
||||
}
|
||||
|
||||
declineProjectInvitation(token: string): Observable<void> {
|
||||
return this.http.post<void>(
|
||||
\`\${this.base}/invitations/\${encodeURIComponent(token)}/decline\`,
|
||||
{},
|
||||
{ withCredentials: true },
|
||||
);
|
||||
}
|
||||
|
||||
items(
|
||||
query: {
|
||||
search?: string;
|
||||
|
||||
Reference in New Issue
Block a user