From 8bb74bd34ae8a4fbb0b6aa2b4baa847612f64e1c Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Mon, 3 Oct 2022 21:08:37 +0200 Subject: [PATCH] feat: set guestAllowed on some note calls These calls are all usable with guests Signed-off-by: Philip Molares --- src/api/private/notes/notes.controller.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api/private/notes/notes.controller.ts b/src/api/private/notes/notes.controller.ts index b823e8de2..a4e7e6ce6 100644 --- a/src/api/private/notes/notes.controller.ts +++ b/src/api/private/notes/notes.controller.ts @@ -69,7 +69,7 @@ export class NotesController { @Permissions(Permission.READ) @UseInterceptors(GetNoteInterceptor) async getNote( - @RequestUser() user: User, + @RequestUser({ guestsAllowed: true }) user: User | null, @RequestNote() note: Note, ): Promise { await this.historyService.updateHistoryEntryTimestamp(note, user); @@ -91,7 +91,7 @@ export class NotesController { @OpenApi(201, 413) @Permissions(Permission.CREATE) async createNote( - @RequestUser() user: User, + @RequestUser({ guestsAllowed: true }) user: User | null, @MarkdownBody() text: string, ): Promise { this.logger.debug('Got raw markdown:\n' + text, 'createNote'); @@ -104,7 +104,7 @@ export class NotesController { @OpenApi(201, 400, 404, 409, 413) @Permissions(Permission.CREATE) async createNamedNote( - @RequestUser() user: User, + @RequestUser({ guestsAllowed: true }) user: User | null, @Param('noteAlias') noteAlias: string, @MarkdownBody() text: string, ): Promise { @@ -141,7 +141,7 @@ export class NotesController { @Permissions(Permission.READ) @Get(':noteIdOrAlias/metadata') async getNoteMetadata( - @RequestUser() user: User, + @RequestUser({ guestsAllowed: true }) user: User | null, @RequestNote() note: Note, ): Promise { return await this.noteService.toNoteMetadataDto(note); @@ -152,7 +152,7 @@ export class NotesController { @Permissions(Permission.READ) @UseInterceptors(GetNoteInterceptor) async getNoteRevisions( - @RequestUser() user: User, + @RequestUser({ guestsAllowed: true }) user: User | null, @RequestNote() note: Note, ): Promise { const revisions = await this.revisionsService.getAllRevisions(note); @@ -188,7 +188,7 @@ export class NotesController { @Permissions(Permission.READ) @UseInterceptors(GetNoteInterceptor) async getNoteRevision( - @RequestUser() user: User, + @RequestUser({ guestsAllowed: true }) user: User | null, @RequestNote() note: Note, @Param('revisionId') revisionId: number, ): Promise {