fix: add GET /api/workspaces/:id/members endpoint
Some checks failed
ci/woodpecker/push/ci Pipeline failed

This commit is contained in:
2026-03-01 15:53:06 -06:00
parent 2463b7b8ba
commit 4e0425177d
2 changed files with 22 additions and 0 deletions

View File

@@ -38,6 +38,16 @@ export class WorkspacesController {
return this.workspacesService.getStats(workspaceId);
}
/**
* GET /api/workspaces/:workspaceId/members
* Returns the list of members for a workspace.
*/
@Get(":workspaceId/members")
@UseGuards(WorkspaceGuard)
async getMembers(@Param("workspaceId") workspaceId: string) {
return this.workspacesService.getMembers(workspaceId);
}
/**
* POST /api/workspaces/:workspaceId/members
* Add a member to a workspace with the specified role.

View File

@@ -321,6 +321,18 @@ export class WorkspacesService {
});
}
/**
* Get members of a workspace.
*/
async getMembers(workspaceId: string) {
return this.prisma.workspaceMember.findMany({
where: { workspaceId },
include: {
user: { select: { id: true, name: true, email: true, createdAt: true } },
},
orderBy: { joinedAt: "asc" },
});
}
private assertCanAssignRole(
actorRole: WorkspaceMemberRole,
requestedRole: WorkspaceMemberRole