mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-16 08:04:45 -04:00
Refactoring of controllers and service interfaces
DTO should only be used for sending information to and from user. Services now have methods which return normal internal objects and methods which convert them to DTOs. This conversion is done in the controlers Signed-off-by: Yannick Bungers <git@innay.de>
This commit is contained in:
parent
e8e269b1bb
commit
0d5b9dea00
8 changed files with 175 additions and 147 deletions
|
@ -78,7 +78,10 @@ export class MeController {
|
|||
|
||||
@UseGuards(TokenAuthGuard)
|
||||
@Get('notes')
|
||||
getMyNotes(@Request() req): NoteMetadataDto[] {
|
||||
return this.notesService.getUserNotes(req.user.userName);
|
||||
async getMyNotes(@Request() req): Promise<NoteMetadataDto[]> {
|
||||
const notes = await this.notesService.getUserNotes(req.user)
|
||||
return Promise.all(
|
||||
notes.map(note => this.notesService.toNoteMetadataDto(note))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue