feat(private-api): add get note metadata call

Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
Philip Molares 2022-08-21 13:02:41 +02:00 committed by David Mehren
parent aad7ddb836
commit ccacbd22b2

View file

@ -20,6 +20,7 @@ import { SessionGuard } from '../../../identity/session.guard';
import { ConsoleLoggerService } from '../../../logger/console-logger.service'; import { ConsoleLoggerService } from '../../../logger/console-logger.service';
import { MediaUploadDto } from '../../../media/media-upload.dto'; import { MediaUploadDto } from '../../../media/media-upload.dto';
import { MediaService } from '../../../media/media.service'; import { MediaService } from '../../../media/media.service';
import { NoteMetadataDto } from '../../../notes/note-metadata.dto';
import { NoteDto } from '../../../notes/note.dto'; import { NoteDto } from '../../../notes/note.dto';
import { Note } from '../../../notes/note.entity'; import { Note } from '../../../notes/note.entity';
import { NoteMediaDeletionDto } from '../../../notes/note.media-deletion.dto'; import { NoteMediaDeletionDto } from '../../../notes/note.media-deletion.dto';
@ -127,6 +128,16 @@ export class NotesController {
return; return;
} }
@UseInterceptors(GetNoteInterceptor)
@Permissions(Permission.READ)
@Get(':noteIdOrAlias/metadata')
async getNoteMetadata(
@RequestUser() user: User,
@RequestNote() note: Note,
): Promise<NoteMetadataDto> {
return await this.noteService.toNoteMetadataDto(note);
}
@Get(':noteIdOrAlias/revisions') @Get(':noteIdOrAlias/revisions')
@OpenApi(200, 404) @OpenApi(200, 404)
@Permissions(Permission.READ) @Permissions(Permission.READ)