Remove unused parameter in InventoryController

This was introduced in 6bd1c23e2d.
This commit is contained in:
Simon Bruder 2023-11-24 20:11:52 +01:00
parent 8a084b1f2e
commit c398c12592
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
2 changed files with 6 additions and 5 deletions

View file

@ -27,7 +27,7 @@ package catering {
+ InventoryController(inventory : UniqueInventory) + InventoryController(inventory : UniqueInventory)
+ list(model : Model) : String + list(model : Model) : String
+ edit(model : Model, pid : Product) : 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 + edit(form : InventoryMutateForm, result : Errors, pid : Product, model : Model) : String
+ add(model : Model) : String + add(model : Model) : String
+ add(model : Model, form : InventoryMutateForm) : String + add(model : Model, form : InventoryMutateForm) : String

View file

@ -66,7 +66,7 @@ class InventoryController {
String edit(Model model, @PathVariable Product pid) { String edit(Model model, @PathVariable Product pid) {
CatalogDummy product = (CatalogDummy) pid; CatalogDummy product = (CatalogDummy) pid;
UniqueInventoryItem item = inventory.findByProduct(pid).get(); UniqueInventoryItem item = inventory.findByProduct(pid).get();
return edit(model, pid, return edit(model,
new InventoryMutateForm(product.getType(), new InventoryMutateForm(product.getType(),
product.getName(), product.getName(),
item.getQuantity(), item.getQuantity(),
@ -77,7 +77,7 @@ class InventoryController {
.map(NumberValue::doubleValueExact))); .map(NumberValue::doubleValueExact)));
} }
String edit(Model model, @PathVariable Product pid, InventoryMutateForm form) { String edit(Model model, InventoryMutateForm form) {
model.addAttribute("actionIsAdd", false); model.addAttribute("actionIsAdd", false);
model.addAttribute("form", form); model.addAttribute("form", form);
@ -86,9 +86,10 @@ class InventoryController {
@PreAuthorize("hasRole('ADMIN')") @PreAuthorize("hasRole('ADMIN')")
@PostMapping("/inventory/edit/{pid}") @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()) { if (result.hasErrors()) {
return edit(model, pid, form); return edit(model, form);
} }
CatalogDummy product = (CatalogDummy) pid; CatalogDummy product = (CatalogDummy) pid;
UniqueInventoryItem item = inventory.findByProduct(pid).get(); UniqueInventoryItem item = inventory.findByProduct(pid).get();