mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-24 20:14:35 -04:00
refactor(api/private/history): validate POST data with DTO
This adds a `HistoryEntryImportListDto` which allows to fully validate incoming JSON data. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
a32d9e8305
commit
fd3fde9cc8
2 changed files with 17 additions and 4 deletions
|
@ -15,7 +15,7 @@ import {
|
|||
} from '@nestjs/common';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
import { HistoryEntryImportDto } from '../../../../history/history-entry-import.dto';
|
||||
import { HistoryEntryImportListDto } from '../../../../history/history-entry-import.dto';
|
||||
import { HistoryEntryUpdateDto } from '../../../../history/history-entry-update.dto';
|
||||
import { HistoryEntryDto } from '../../../../history/history-entry.dto';
|
||||
import { HistoryService } from '../../../../history/history.service';
|
||||
|
@ -53,9 +53,9 @@ export class HistoryController {
|
|||
@OpenApi(201, 404)
|
||||
async setHistory(
|
||||
@RequestUser() user: User,
|
||||
@Body('history') history: HistoryEntryImportDto[],
|
||||
@Body() historyImport: HistoryEntryImportListDto,
|
||||
): Promise<void> {
|
||||
await this.historyService.setHistory(user, history);
|
||||
await this.historyService.setHistory(user, historyImport.history);
|
||||
}
|
||||
|
||||
@Delete()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue