NotesService: toNotePermissionsDto does not need to be async

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-02-24 21:17:05 +01:00
parent b5281991ef
commit d8d105ed75
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
2 changed files with 3 additions and 4 deletions

View file

@ -221,7 +221,7 @@ export class NotesController {
if (!this.permissionsService.isOwner(req.user, note)) { if (!this.permissionsService.isOwner(req.user, note)) {
throw new UnauthorizedException('Updating note denied!'); throw new UnauthorizedException('Updating note denied!');
} }
return await this.noteService.toNotePermissionsDto( return this.noteService.toNotePermissionsDto(
this.noteService.updateNotePermissions(note, updateDto), this.noteService.updateNotePermissions(note, updateDto),
); );
} catch (e) { } catch (e) {

View file

@ -295,12 +295,11 @@ export class NotesService {
} }
/** /**
* @async
* Build NotePermissionsDto from a note. * Build NotePermissionsDto from a note.
* @param {Note} note - the note to use * @param {Note} note - the note to use
* @return {NotePermissionsDto} the built NotePermissionDto * @return {NotePermissionsDto} the built NotePermissionDto
*/ */
async toNotePermissionsDto(note: Note): Promise<NotePermissionsDto> { toNotePermissionsDto(note: Note): Promise<NotePermissionsDto> {
return { return {
owner: this.usersService.toUserDto(note.owner), owner: this.usersService.toUserDto(note.owner),
sharedToUsers: note.userPermissions.map((noteUserPermission) => ({ sharedToUsers: note.userPermissions.map((noteUserPermission) => ({
@ -331,7 +330,7 @@ export class NotesService {
editedBy: note.authorColors.map( editedBy: note.authorColors.map(
(authorColor) => authorColor.user.userName, (authorColor) => authorColor.user.userName,
), ),
permissions: await this.toNotePermissionsDto(note), permissions: this.toNotePermissionsDto(note),
tags: this.toTagList(note), tags: this.toTagList(note),
updateTime: (await this.getLatestRevision(note)).createdAt, updateTime: (await this.getLatestRevision(note)).createdAt,
updateUser: this.usersService.toUserDto( updateUser: this.usersService.toUserDto(