BAEL-4842 - Use React and Spring Boot to Build a Simple CRUD App
Code review issues
This commit is contained in:
parent
0d875a5b20
commit
9e36a37493
@ -1,3 +1 @@
|
|||||||
### Relevant Articles:
|
### 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/)
|
|
||||||
|
@ -20,7 +20,7 @@ public class ClientsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public List getClients() {
|
public List<Client> getClients() {
|
||||||
return clientRepository.findAll();
|
return clientRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ public class ClientsController {
|
|||||||
return ResponseEntity.created(new URI("/clients/" + savedClient.getId())).body(savedClient);
|
return ResponseEntity.created(new URI("/clients/" + savedClient.getId())).body(savedClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("{id}")
|
@PutMapping("/{id}")
|
||||||
public ResponseEntity updateClient(@PathVariable Long id, @RequestBody Client client) {
|
public ResponseEntity updateClient(@PathVariable Long id, @RequestBody Client client) {
|
||||||
Client currentClient = clientRepository.findById(id).orElseThrow(RuntimeException::new);
|
Client currentClient = clientRepository.findById(id).orElseThrow(RuntimeException::new);
|
||||||
currentClient.setName(client.getName());
|
currentClient.setName(client.getName());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user