Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rmisteli committed Nov 12, 2024
1 parent 99f734b commit 2ca0752
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ public class CustomerController {

private final CustomerService customerService;

@DeleteMapping("{customerId}")
public ResponseEntity deleteCustomer(@PathVariable("customerId") UUID customerId) {
customerService.deleteCustomerById(customerId);

return new ResponseEntity(HttpStatus.NO_CONTENT);
}

@PutMapping("{customerId}")
public ResponseEntity updateById(@PathVariable("customerId") UUID customerId, @RequestBody Customer customer) {
customerService.updateCustomerById(customerId, customer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ public interface CustomerService {
Customer saveNewCustomer(Customer customer);

void updateCustomerById(UUID customerId, Customer customer);

void deleteCustomerById(UUID customerId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,9 @@ public void updateCustomerById(UUID customerId, Customer customer) {

customerMap.put(existingCustomer.getId(), existingCustomer);
}

@Override
public void deleteCustomerById(UUID customerId) {
customerMap.remove(customerId);
}
}

0 comments on commit 2ca0752

Please sign in to comment.