aboutsummaryrefslogtreecommitdiff
path: root/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java
diff options
context:
space:
mode:
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.java7
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) {