fixed PUT nullable merchant/note
This commit is contained in:
parent
389ef8c7ce
commit
f390e2a8c3
7 changed files with 74 additions and 52 deletions
|
|
@ -58,15 +58,16 @@ export class ExpensesController {
|
|||
}
|
||||
}
|
||||
|
||||
// @Put()
|
||||
// @HttpCode(HttpStatus.OK)
|
||||
// public async update(@Body() expense: UpdateExpenseDto): Promise<GetExpenseDto> {
|
||||
// if (!expense.id) {
|
||||
// throw new BadRequestException('Expense ID cannot be empty.');
|
||||
// }
|
||||
//
|
||||
// return await this.expensesService.update(expense);
|
||||
// }
|
||||
@Put()
|
||||
@HttpCode(HttpStatus.OK)
|
||||
public async update(@Body() expense: UpdateExpenseDto): Promise<GetExpenseDto> {
|
||||
if (!expense.id) {
|
||||
throw new BadRequestException('Expense ID cannot be empty.');
|
||||
}
|
||||
// TODO: Validate date/cents/category exist...
|
||||
|
||||
return await this.expensesService.update(expense);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
@HttpCode(HttpStatus.NO_CONTENT)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue