From c398c12592b2fdc7cc7479819042b198de6215a3 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Fri, 24 Nov 2023 20:11:52 +0100 Subject: [PATCH] Remove unused parameter in InventoryController This was introduced in 6bd1c23e2d92664cb8fdf2e1d8286b80d5e54de7. --- src/main/asciidoc/models/design/inventory.puml | 2 +- .../java/catering/inventory/InventoryController.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/asciidoc/models/design/inventory.puml b/src/main/asciidoc/models/design/inventory.puml index 9c2de62..19e64bc 100644 --- a/src/main/asciidoc/models/design/inventory.puml +++ b/src/main/asciidoc/models/design/inventory.puml @@ -27,7 +27,7 @@ package catering { + InventoryController(inventory : UniqueInventory) + list(model : Model) : String + edit(model : Model, pid : Product) : String - + edit(model : Model, pid : Product, form : InventoryMutateForm) : String + + edit(model : Model, form : InventoryMutateForm) : String + edit(form : InventoryMutateForm, result : Errors, pid : Product, model : Model) : String + add(model : Model) : String + add(model : Model, form : InventoryMutateForm) : String diff --git a/src/main/java/catering/inventory/InventoryController.java b/src/main/java/catering/inventory/InventoryController.java index 9eaabbc..e5711db 100644 --- a/src/main/java/catering/inventory/InventoryController.java +++ b/src/main/java/catering/inventory/InventoryController.java @@ -66,7 +66,7 @@ class InventoryController { String edit(Model model, @PathVariable Product pid) { CatalogDummy product = (CatalogDummy) pid; UniqueInventoryItem item = inventory.findByProduct(pid).get(); - return edit(model, pid, + return edit(model, new InventoryMutateForm(product.getType(), product.getName(), item.getQuantity(), @@ -77,7 +77,7 @@ class InventoryController { .map(NumberValue::doubleValueExact))); } - String edit(Model model, @PathVariable Product pid, InventoryMutateForm form) { + String edit(Model model, InventoryMutateForm form) { model.addAttribute("actionIsAdd", false); model.addAttribute("form", form); @@ -86,9 +86,10 @@ class InventoryController { @PreAuthorize("hasRole('ADMIN')") @PostMapping("/inventory/edit/{pid}") - String edit(@Valid @ModelAttribute("form") InventoryMutateForm form, Errors result, @PathVariable Product pid, Model model) { + String edit(@Valid @ModelAttribute("form") InventoryMutateForm form, Errors result, @PathVariable Product pid, + Model model) { if (result.hasErrors()) { - return edit(model, pid, form); + return edit(model, form); } CatalogDummy product = (CatalogDummy) pid; UniqueInventoryItem item = inventory.findByProduct(pid).get();