Fixed error, caused by returning JSON of created income/expense

This commit is contained in:
Dmitrii Cravcenco
2023-10-25 11:50:51 +03:00
parent e9fd388909
commit 1be5250c99
2 changed files with 4 additions and 6 deletions

View File

@@ -41,7 +41,7 @@ public class IncomeController {
}
@PostMapping()
public ResponseEntity<IncomeDTO> createNewIncome(@RequestBody IncomeCreationDTO incomeDTO,
public ResponseEntity<Void> createNewIncome(@RequestBody IncomeCreationDTO incomeDTO,
BindingResult bindingResult) {
Income income = incomeMapper.toIncome(incomeDTO);
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
@@ -54,8 +54,7 @@ public class IncomeController {
System.out.println(income);
incomeService.createOrUpdate(income);
IncomeDTO createdIncomeDTO = incomeMapper.toDto(income);
return ResponseEntity.status(HttpStatus.CREATED).body(createdIncomeDTO);
return ResponseEntity.status(HttpStatus.CREATED).build();
}
return ResponseEntity.notFound().build();