editCategory wirft 404 bei falscher categoryID
This commit is contained in:
1 parent
9fa60a8d6d
commit
6f503f311e
1 file changed
+1
-1
+1
-1
@@ -52,7 +52,7 @@ public class ShoppingCategoryController {
|
||||
|
||||
@PatchMapping("/api/categories/{categoryID}")
|
||||
public ResponseEntity<Void> editCategory(@PathVariable UUID categoryID,@RequestBody ShoppingCategoryPatchDTO toChange){
|
||||
ShoppingCategory category = shoppingCategoryRepository.findById(categoryID).orElseThrow();
|
||||
ShoppingCategory category = shoppingCategoryRepository.findById(categoryID).orElseThrow(() -> new ResourceNotFoundException("categoryID",categoryID));
|
||||
|
||||
if(toChange.categoryName() != null) category.setCategoryName(toChange.categoryName());
|
||||
|
||||
|
||||
Reference in new issue
Block a user