aboutsummaryrefslogtreecommitdiff
path: root/ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java
diff options
context:
space:
mode:
authorGunther6070 <haydenhartman10@yahoo.com>2025-03-31 20:47:10 -0400
committerGunther6070 <haydenhartman10@yahoo.com>2025-03-31 20:47:10 -0400
commit94bbc8feb12fec210dae76ff90b6a782829a9c04 (patch)
treedefa0c8a2b4f0ee0b2bc147f386bb0373965b1cd /ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java
parentcd8b846a4455aba7664cc03e219f471d251ff9bf (diff)
parentcb5be32bf0d050cc1fd37d7cc9b4c51e1c51fffe (diff)
downloadJellySolutions-94bbc8feb12fec210dae76ff90b6a782829a9c04.tar.gz
JellySolutions-94bbc8feb12fec210dae76ff90b6a782829a9c04.tar.bz2
JellySolutions-94bbc8feb12fec210dae76ff90b6a782829a9c04.zip
Merge branch 'list-and-cupboard-component-refactor' into css
# Conflicts: # ufund-ui/src/app/components/cupboard/cupboard.component.ts
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.java4
1 files changed, 4 insertions, 0 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 0652696..993e7c1 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
@@ -39,6 +39,8 @@ public class CupboardService {
if (maxGoal <= 0) {
throw new IllegalArgumentException("Max Goal must be greater than zero");
+ } else if (goalType.equals(Need.GoalType.PHYSICAL) && maxGoal % 1 != 0) {
+ throw new IllegalArgumentException("Cannot have non whole number value for physical goal");
}
for (Need searchNeed : cupboardDAO.getNeeds()) {
@@ -99,6 +101,8 @@ public class CupboardService {
}
if (need.getMaxGoal() <= 0) {
throw new IllegalArgumentException("Goal must be greater than 0");
+ } else if (need.getType().equals(Need.GoalType.PHYSICAL) && need.getMaxGoal() % 1 != 0) {
+ throw new IllegalArgumentException("Cannot have non whole number value for physical goal");
}
return cupboardDAO.updateNeed(need);
}