diff options
author | Tyler Ferrari <69283684+Sowgro@users.noreply.github.com> | 2025-03-31 20:19:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-31 20:19:44 -0400 |
commit | b7539414ac6aa8efd423a3a9a0a2b5586757e19c (patch) | |
tree | 39a21dc367d3891c53e849f5e1ce81eaebc0fd21 /ufund-api/src/main/java/com/ufund/api/ufundapi/controller | |
parent | 459c716d5429c040ac25435aab93f896f2fd79c3 (diff) | |
parent | a2e1329a510375fdada021c3d6a2f631a9c162ee (diff) | |
download | JellySolutions-b7539414ac6aa8efd423a3a9a0a2b5586757e19c.tar.gz JellySolutions-b7539414ac6aa8efd423a3a9a0a2b5586757e19c.tar.bz2 JellySolutions-b7539414ac6aa8efd423a3a9a0a2b5586757e19c.zip |
Merge pull request #21 from RIT-SWEN-261-02/need-description
Need description and image support
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/controller')
-rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java | 6 |
1 files changed, 4 insertions, 2 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 d426aee..d448f6c 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 @@ -5,7 +5,6 @@ import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; -import com.ufund.api.ufundapi.service.AuthService; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.DeleteMapping; @@ -22,6 +21,7 @@ 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.AuthService; import com.ufund.api.ufundapi.service.CupboardService; @RestController @@ -55,14 +55,16 @@ public class CupboardController { LOG.log(Level.INFO, "POST /cupboard body={0}", params); String name = (String) params.get("name"); + String image = (String) params.get("image"); String location = (String) params.get("location"); double maxGoal = ((Number) params.get("maxGoal")).doubleValue(); boolean urgent = (Boolean) params.get("urgent"); + String description = (String) params.get("description"); Need.GoalType goalType = GoalType.valueOf((String) params.get("type")); try { authService.keyHasAccessToCupboard(key); - Need need = cupboardService.createNeed(name, location, maxGoal, goalType, urgent); + Need need = cupboardService.createNeed(name, image, location, maxGoal, goalType, urgent, description); return new ResponseEntity<>(need, HttpStatus.OK); } catch (DuplicateKeyException ex) { LOG.log(Level.WARNING, ex.getLocalizedMessage()); |