Compare commits

...

1 Commits

Author SHA1 Message Date
4e0425177d fix: add GET /api/workspaces/:id/members endpoint
Some checks failed
ci/woodpecker/push/ci Pipeline failed
2026-03-01 15:53:06 -06:00
2 changed files with 22 additions and 0 deletions

View File

@@ -38,6 +38,16 @@ export class WorkspacesController {
return this.workspacesService.getStats(workspaceId); 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 * POST /api/workspaces/:workspaceId/members
* Add a member to a workspace with the specified role. * 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( private assertCanAssignRole(
actorRole: WorkspaceMemberRole, actorRole: WorkspaceMemberRole,
requestedRole: WorkspaceMemberRole requestedRole: WorkspaceMemberRole