From bb9ce55cb5b55a6aaed2399e39a01d68f2491ce3 Mon Sep 17 00:00:00 2001
From: sowgro <tpoke.ferrari@gmail.com>
Date: Thu, 6 Mar 2025 21:41:39 -0500
Subject: Push current changes (working on documentation and tests)

---
 .../ufund/api/ufundapi/controller/CupboardController.java | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

(limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java')

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 6b0bb71..dfcb8a3 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
@@ -40,8 +40,11 @@ public class CupboardController {
     /**
      * Creates a Need with the provided object
      *
-     * @param need The need to create
-     * @return OK response and the need if it was successful, INTERNAL_SERVER_ERROR otherwise
+     * @param params The need to create
+     * @return OK response and the need if it was successful,
+     *         CONFLICT if another need with the same name exists
+     *         UNPROCESSABLE_ENTITY if the need contains bad data
+     *         INTERNAL_SERVER_ERROR otherwise
      */
     @PostMapping("")
     public ResponseEntity<Need> createNeed(@RequestBody Map<String, String> params) {
@@ -50,10 +53,8 @@ public class CupboardController {
         Need.GoalType goalType = GoalType.valueOf(params.get("maxGoal"));
 
         try {
-            
             Need need = cupboardService.createNeed(name, maxGoal, goalType);
             return new ResponseEntity<>(need, HttpStatus.OK);
-
         } catch (DuplicateKeyException ex) {
             return new ResponseEntity<>(HttpStatus.CONFLICT);
         } catch (IllegalArgumentException ex) {
@@ -113,10 +114,8 @@ public class CupboardController {
      * 
      * @param id The id used to locate the {@link Need need}
      * 
-     * @return ResponseEntity with {@link Need need} object and HTTP status of OK if
-     *         found<br>
+     * @return ResponseEntity with {@link Need need} object and HTTP status of OK if found<br>
      *         ResponseEntity with HTTP status of NOT_FOUND if not found<br>
-     *         ResponseEntity with HTTP status of INTERNAL_SERVER_ERROR otherwise
      */
     @GetMapping("/{id}")
     public ResponseEntity<Need> getNeed(@PathVariable int id) {
@@ -129,7 +128,6 @@ public class CupboardController {
             } else {
                 return new ResponseEntity<>(HttpStatus.NOT_FOUND);
             }
-
         } catch (IOException e) {
             LOG.log(Level.SEVERE, e.getLocalizedMessage());
             return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
@@ -143,7 +141,6 @@ public class CupboardController {
      * @param need The need to update
      * @return OK response and the need if it was successful, or INTERNAL_SERVER_ERROR if there was an issue
      */
-
     @PutMapping("")
     public ResponseEntity<Need> updateNeed(@RequestBody Need need) {
         try {
-- 
cgit v1.2.3