feat: favorites (#2103)

* feat: favorites and templates(ee)

* rename migrations

* fix sidebar

* cleanup tabs

* fix

* turn off templates

* cleanup

* uuid validation
This commit is contained in:
Philip Okugbe
2026-04-12 22:06:25 +01:00
committed by GitHub
parent 57efb91bd3
commit d42091ccb1
90 changed files with 4557 additions and 187 deletions
+35 -1
View File
@@ -53,7 +53,41 @@ export class SpaceController {
pagination: PaginationOptions,
@AuthUser() user: User,
) {
return this.spaceMemberService.getUserSpaces(user.id, pagination);
const result = await this.spaceMemberService.getUserSpaces(
user.id,
pagination,
);
if (result.items.length > 0) {
const spaceIds = result.items.map((s) => s.id);
const roles = await this.spaceMemberRepo.getUserRolesForSpaces(
user.id,
spaceIds,
);
const roleMap = new Map<string, string[]>();
for (const row of roles) {
const existing = roleMap.get(row.spaceId) || [];
existing.push(row.role);
roleMap.set(row.spaceId, existing);
}
result.items = result.items.map((space) => {
const spaceRoles = roleMap.get(space.id);
const role = spaceRoles
? findHighestUserSpaceRole(
spaceRoles.map((r) => ({ userId: user.id, role: r })),
)
: undefined;
return {
...space,
membership: { userId: user.id, role },
};
});
}
return result;
}
@HttpCode(HttpStatus.OK)