mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-22 03:05:19 -04:00
HistoryService: Refactor deleteHistoryEntry
The function now expects a `Note` object instead of a noteId to make it more consistent with other functions. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
c515569299
commit
b552fc10b6
6 changed files with 13 additions and 13 deletions
|
@ -107,11 +107,13 @@ export class HistoryController {
|
|||
}
|
||||
|
||||
@Delete(':note')
|
||||
async deleteHistoryEntry(@Param('note') noteId: string): Promise<void> {
|
||||
async deleteHistoryEntry(
|
||||
@Param('note', GetNotePipe) note: Note,
|
||||
): Promise<void> {
|
||||
try {
|
||||
// ToDo: use actual user here
|
||||
const user = await this.userService.getUserByUsername('hardcoded');
|
||||
await this.historyService.deleteHistoryEntry(noteId, user);
|
||||
await this.historyService.deleteHistoryEntry(note, user);
|
||||
} catch (e) {
|
||||
if (e instanceof NotInDBError) {
|
||||
throw new NotFoundException(e.message);
|
||||
|
|
|
@ -149,7 +149,7 @@ export class MeController {
|
|||
@ApiNotFoundResponse({ description: notFoundDescription })
|
||||
async deleteHistoryEntry(
|
||||
@RequestUser() user: User,
|
||||
@Param('note') note: string,
|
||||
@Param('note', GetNotePipe) note: Note,
|
||||
): Promise<void> {
|
||||
// ToDo: Check if user is allowed to delete note
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue