refactor(note-permissions-dto): do not embed User objects

This is part of an effort to consistently not embed User objects
in API responses. Usernames are returned instead.

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-01-16 22:19:53 +01:00
parent 6cd3feb82c
commit b955faa983
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
4 changed files with 9 additions and 12 deletions

View file

@ -373,7 +373,7 @@ export class NotesService {
const userPermissions = await note.userPermissions;
const groupPermissions = await note.groupPermissions;
return {
owner: owner ? this.usersService.toUserDto(owner) : null,
owner: owner ? owner.username : null,
sharedToUsers: userPermissions.map((noteUserPermission) => ({
user: this.usersService.toUserDto(noteUserPermission.user),
canEdit: noteUserPermission.canEdit,