aboutsummaryrefslogtreecommitdiff
path: root/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java
diff options
context:
space:
mode:
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);
}