client get by id
This commit is contained in:
@@ -19,11 +19,20 @@ public class ClientController {
|
|||||||
this.clientService = clientService;
|
this.clientService = clientService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/all")
|
@GetMapping("/get/all")
|
||||||
public List<ClientDTO> getAllClients() {
|
public List<ClientDTO> getAllClients() {
|
||||||
return clientService.getAllClients();
|
return clientService.getAllClients();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get/{id}")
|
||||||
|
public ResponseEntity getClientById(@PathVariable long id) {
|
||||||
|
if(clientService.getClientById(id) != null) {
|
||||||
|
return new ResponseEntity(clientService.getClientById(id), HttpStatus.OK);
|
||||||
|
} else {
|
||||||
|
return new ResponseEntity(HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: do zrobienia walidacja danych
|
// TODO: do zrobienia walidacja danych
|
||||||
@PutMapping("/edit/{id}")
|
@PutMapping("/edit/{id}")
|
||||||
public ResponseEntity updateClient(@PathVariable("id") long id, @RequestBody ClientDTO clientDTO) {
|
public ResponseEntity updateClient(@PathVariable("id") long id, @RequestBody ClientDTO clientDTO) {
|
||||||
|
|||||||
Reference in New Issue
Block a user