Include community details in user spaces response

This commit is contained in:
faris Aljohari
2025-02-26 16:19:55 +03:00
parent cb6d359810
commit e3e2981673

View File

@ -94,7 +94,7 @@ export class ProjectUserService {
'invitedBy',
'isEnabled',
],
relations: ['roleType', 'spaces.space'],
relations: ['roleType', 'spaces.space', 'spaces.space.community'],
});
if (!user) {
@ -114,7 +114,14 @@ export class ProjectUserService {
roleType: user.roleType.type,
createdDate,
createdTime,
spaces: user.spaces.map((space) => space.space),
spaces: user.spaces.map(({ space }) => {
const { community, ...spaceWithoutCommunity } = space;
return {
...spaceWithoutCommunity,
communityUuid: community.uuid,
communityName: community.name,
};
}),
},
statusCode: HttpStatus.OK,
});