Skip to content

Commit

Permalink
Fix controller to app
Browse files Browse the repository at this point in the history
  • Loading branch information
ailtonbsj committed Aug 27, 2022
1 parent 7182083 commit 09caf16
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public List<NivelEscolar> index(@RequestParam Optional<String> q) {
}

@PostMapping
public NivelEscolar store(@RequestBody NivelEscolar nivelEscolar) {
return repository.save(nivelEscolar);
public Long store(@RequestBody NivelEscolar nivelEscolar) {
return repository.save(nivelEscolar).getId();
}

@GetMapping("{id}")
Expand All @@ -49,12 +49,12 @@ public NivelEscolar show(@PathVariable Long id) {
}

@PatchMapping
public NivelEscolar update(@RequestBody NivelEscolar nivelEscolar) {
public Long update(@RequestBody NivelEscolar nivelEscolar) {
NivelEscolar ent = repository.findById(nivelEscolar.getId()).orElseThrow(
() -> new ResponseStatusException(HttpStatus.NOT_FOUND));
ent.setNivelEscolar(nivelEscolar.getNivelEscolar());
ent.setUpdatedAt(LocalDateTime.now());
return repository.save(ent);
return repository.save(ent).getId();
}

@DeleteMapping("{id}")
Expand Down

0 comments on commit 09caf16

Please sign in to comment.