aboutsummaryrefslogtreecommitdiff
path: root/ufund-api/src/main/java/com/ufund/api/ufundapi/service
diff options
context:
space:
mode:
authorbenal01 <bja4245@rit.edu>2025-04-02 23:00:14 -0400
committerGitHub <noreply@github.com>2025-04-02 23:00:14 -0400
commit2f67d2218b48937a370c5562eff5141b80475524 (patch)
treec744dd407f46f71b692aaaad6d4c66237c8ba9a5 /ufund-api/src/main/java/com/ufund/api/ufundapi/service
parent2b7c42ffacaaf884bc9497e975c0c3274e9f966e (diff)
parentfb6d8140830bbb5081056105eaa775f26885da8f (diff)
downloadJellySolutions-2f67d2218b48937a370c5562eff5141b80475524.tar.gz
JellySolutions-2f67d2218b48937a370c5562eff5141b80475524.tar.bz2
JellySolutions-2f67d2218b48937a370c5562eff5141b80475524.zip
Merge pull request #25 from RIT-SWEN-261-02/need-image
Need image support + need page image styling
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/service')
-rw-r--r--ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java3
-rw-r--r--ufund-api/src/main/java/com/ufund/api/ufundapi/service/UserService.java10
2 files changed, 13 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 993e7c1..859194a 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
@@ -119,6 +119,9 @@ public class CupboardService {
if (checkoutAmount <= 0) {
throw new IllegalArgumentException("Amount must be greater than 0");
}
+ if ((checkoutAmount % 1 != 0) && (cupboardDAO.getNeed(id).getType() == Need.GoalType.PHYSICAL)) {
+ throw new IllegalArgumentException("Physical amounts must be whole numbers");
+ }
authService.keyIsValid(key);
Need need = cupboardDAO.getNeed(id);
need.incrementCurrent(checkoutAmount);
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/service/UserService.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/service/UserService.java
index 6e27f50..8b34e68 100644
--- a/ufund-api/src/main/java/com/ufund/api/ufundapi/service/UserService.java
+++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/service/UserService.java
@@ -56,6 +56,16 @@ public class UserService {
}
/**
+ * Returns the total number of users
+ *
+ * @return The number of users
+ * @throws IOException If there was any problem saving the file
+ */
+ public int getUserCount() throws IOException {
+ return userDAO.getUserCount();
+ }
+
+ /**
* Updates a user
*
* @param user The ID of the user to update