diff options
author | Hayden Hartman <haydenhartman10@gmail.com> | 2025-03-18 17:17:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-18 17:17:23 -0400 |
commit | db9e4a8c26dc5252cfe0974843bc391c57edd07d (patch) | |
tree | 0c8aba41ae378fe04e8312ab9eff48656732c9c8 /ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java | |
parent | c7c4e037d655762cc6b394a460effbcd8816d175 (diff) | |
parent | 7a5396b65fcde8153c8eeae565bfecb7de37b23f (diff) | |
download | JellySolutions-2.1.tar.gz JellySolutions-2.1.tar.bz2 JellySolutions-2.1.zip |
Merge pull request #14 from RIT-SWEN-261-02/funding_basketv2.1
funding-basket merge
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java')
-rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java index 9592490..36ae341 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java @@ -17,10 +17,10 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import com.ufund.api.ufundapi.DuplicateKeyException; import com.ufund.api.ufundapi.model.Need; import com.ufund.api.ufundapi.model.Need.GoalType; import com.ufund.api.ufundapi.service.CupboardService; -import com.ufund.api.ufundapi.DuplicateKeyException; @RestController @RequestMapping("cupboard") @@ -50,7 +50,7 @@ public class CupboardController { public ResponseEntity<Need> createNeed(@RequestBody Map<String, Object> params) { System.out.println(params); String name = (String) params.get("name"); - int maxGoal = (int) params.get("maxGoal"); + double maxGoal = (double) params.get("maxGoal"); Need.GoalType goalType = GoalType.valueOf((String) params.get("type")); try { @@ -59,7 +59,7 @@ public class CupboardController { } catch (DuplicateKeyException ex) { return new ResponseEntity<>(HttpStatus.CONFLICT); } catch (IllegalArgumentException ex) { - return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY); + return new ResponseEntity<>(HttpStatus.BAD_REQUEST); } catch (IOException ex) { return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); } @@ -144,6 +144,7 @@ public class CupboardController { */ @PutMapping("/{id}") public ResponseEntity<Need> updateNeed(@RequestBody Need need, @PathVariable int id) { + LOG.log(Level.INFO, "Updating need: " + need); try { Need updatedNeed = cupboardService.updateNeed(need, id); if (updatedNeed != null) { |