aboutsummaryrefslogtreecommitdiff
path: root/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2025-03-07 00:02:56 -0500
committersowgro <tpoke.ferrari@gmail.com>2025-03-07 00:02:56 -0500
commit34903015992ac0cd7719b662af3ceb54a801351c (patch)
tree322e5477a5d251f85d9b9ef193fac26374319a4b /ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java
parenta3fbcd713ae9a6b3f38dcc42a5c4c2f369a5d6f5 (diff)
downloadJellySolutions-34903015992ac0cd7719b662af3ceb54a801351c.tar.gz
JellySolutions-34903015992ac0cd7719b662af3ceb54a801351c.tar.bz2
JellySolutions-34903015992ac0cd7719b662af3ceb54a801351c.zip
Finish update methods
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java')
-rw-r--r--ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java
index 15f8442..c8609ab 100644
--- a/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java
+++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java
@@ -78,13 +78,17 @@ public class CupboardService {
}
/**
- * Modify a need
- * // TODO
- * @param need
- * @return
+ * Updates a need
+ *
+ * @param id The ID of the need to update
+ * @param need The need object to set (note: the ID is ignored)
+ * @return The updated need object
* @throws IOException Thrown if there was an issue saving the changes
*/
- public Need updateNeed(Need need) throws IOException {
+ public Need updateNeed(Need need, int id) throws IOException {
+ if (need.getId() != id) {
+ throw new IllegalArgumentException("ID in URL and body must match");
+ }
return cupboardDAO.updateNeed(need);
}