client get by id

This commit is contained in:
2025-04-17 13:45:51 +02:00
parent ba7e82e90c
commit e60f959dfb

View File

@@ -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) {