deleteItem 404 exception hinzugefügt
This commit is contained in:
1 parent
1e1b8d0ec5
commit
71fd6ee420
1 file changed
+1
-3
@@ -66,9 +66,7 @@ public class ShoppingItemController {
|
||||
|
||||
@DeleteMapping("/api/items/{itemID}")
|
||||
public ResponseEntity<Void> deleteItem(@PathVariable UUID itemID){
|
||||
if(!shoppingItemRepository.existsById(itemID)){
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
shoppingItemRepository.findById(itemID).orElseThrow(() ->new ResourceNotFoundException("itemID",itemID));
|
||||
shoppingItemRepository.deleteById(itemID);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user