BAEL-4842 - Use React and Spring Boot to Build a Simple CRUD App

Code review issues
This commit is contained in:
Sallo Szrajbman 2021-04-18 19:36:31 +01:00
parent 0d875a5b20
commit 9e36a37493
2 changed files with 2 additions and 4 deletions

View File

@ -1,3 +1 @@
### Relevant Articles:
- [Use React and Spring Boot to Build a Simple CRUD App](https://www.baeldung.com/use-react-and-spring-boot-to-build-a-simple-crud-app/)

View File

@ -20,7 +20,7 @@ public class ClientsController {
}
@GetMapping
public List getClients() {
public List<Client> getClients() {
return clientRepository.findAll();
}
@ -35,7 +35,7 @@ public class ClientsController {
return ResponseEntity.created(new URI("/clients/" + savedClient.getId())).body(savedClient);
}
@PutMapping("{id}")
@PutMapping("/{id}")
public ResponseEntity updateClient(@PathVariable Long id, @RequestBody Client client) {
Client currentClient = clientRepository.findById(id).orElseThrow(RuntimeException::new);
currentClient.setName(client.getName());