NotesController: Add PUT :noteIdOrAlias/metadata route

Signed-off-by: David Mehren <git@herrmehren.de>
Co-authored-by: Yannick Bungers <git@innay.de>
This commit is contained in:
David Mehren 2020-10-03 15:53:30 +02:00
parent 3726b27849
commit c1886ff1dc
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -9,6 +9,7 @@ import {
Put, Put,
} from '@nestjs/common'; } from '@nestjs/common';
import { ConsoleLoggerService } from '../../../logger/console-logger.service'; import { ConsoleLoggerService } from '../../../logger/console-logger.service';
import { NoteMetadataUpdateDto } from '../../../notes/note-metadata.dto';
import { NotePermissionsUpdateDto } from '../../../notes/note-permissions.dto'; import { NotePermissionsUpdateDto } from '../../../notes/note-permissions.dto';
import { NotesService } from '../../../notes/notes.service'; import { NotesService } from '../../../notes/notes.service';
import { RevisionsService } from '../../../revisions/revisions.service'; import { RevisionsService } from '../../../revisions/revisions.service';
@ -21,7 +22,7 @@ export class NotesController {
private noteService: NotesService, private noteService: NotesService,
private revisionsService: RevisionsService, private revisionsService: RevisionsService,
) { ) {
this.logger.setContext(NotesController.name); this.logger.setContext(NotesController.name);
} }
@Post() @Post()
@ -72,6 +73,14 @@ export class NotesController {
return this.noteService.getNoteMetadata(noteIdOrAlias); return this.noteService.getNoteMetadata(noteIdOrAlias);
} }
@Put(':noteIdOrAlias/metadata')
updateNoteMetadata(
@Param('noteIdOrAlias') noteIdOrAlias: string,
@Body() updateDto: NoteMetadataUpdateDto,
) {
return this.noteService.updateNoteMetadata(noteIdOrAlias, updateDto);
}
@Put(':noteIdOrAlias/permissions') @Put(':noteIdOrAlias/permissions')
updateNotePermissions( updateNotePermissions(
@Param('noteIdOrAlias') noteIdOrAlias: string, @Param('noteIdOrAlias') noteIdOrAlias: string,