diff options
| author | Kevin J Hoerr <khoerr@ksmpartners.com> | 2022-01-27 15:27:03 -0500 |
|---|---|---|
| committer | Kevin J Hoerr <khoerr@ksmpartners.com> | 2022-01-27 15:27:03 -0500 |
| commit | 5ba2472e72f3b29cf456c3f9fd7deeed45506c1c (patch) | |
| tree | c92b828049845e9cbcbec0e3747e68ef4f1e7f03 /src/main/java/dev/submelon/pantry/PantryItemController.java | |
| parent | 615c8a0fc8d2b35da7df90115456d33444104c41 (diff) | |
| download | pantry-5ba2472e72f3b29cf456c3f9fd7deeed45506c1c.tar.gz pantry-5ba2472e72f3b29cf456c3f9fd7deeed45506c1c.tar.bz2 pantry-5ba2472e72f3b29cf456c3f9fd7deeed45506c1c.zip | |
Remove shortid; Add quantityUnitType
Diffstat (limited to 'src/main/java/dev/submelon/pantry/PantryItemController.java')
| -rw-r--r-- | src/main/java/dev/submelon/pantry/PantryItemController.java | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/main/java/dev/submelon/pantry/PantryItemController.java b/src/main/java/dev/submelon/pantry/PantryItemController.java index 37a71e9..1968139 100644 --- a/src/main/java/dev/submelon/pantry/PantryItemController.java +++ b/src/main/java/dev/submelon/pantry/PantryItemController.java @@ -3,7 +3,6 @@ package dev.submelon.pantry; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -17,12 +16,12 @@ public class PantryItemController { @PostMapping(path="/add") @ResponseBody - Integer addNewItem(@RequestParam String name, @RequestParam String description, @RequestParam String shortid, @RequestParam double quantity) { + Integer addNewItem(@RequestParam String name, @RequestParam String description, @RequestParam double quantity, @RequestParam String quantityUnitType) { PantryItem item = new PantryItem(); item.setName(name); item.setDescription(description); - item.setShortid(shortid); item.setQuantity(quantity); + item.setQuantityUnitType(quantityUnitType); PantryItem updatedItem = itemRepository.save(item); return updatedItem.getId(); @@ -34,10 +33,4 @@ public class PantryItemController { return itemRepository.findAll(); } - @GetMapping(path="/{shortid}") - @ResponseBody - PantryItem getByShortid(@PathVariable String shortid) { - return itemRepository.findByShortid(shortid).get(); - } - } |
