diff options
author | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-07 14:06:34 -0400 |
---|---|---|
committer | Gunther6070 <haydenhartman10@yahoo.com> | 2025-04-07 14:06:34 -0400 |
commit | d101a0807c1eb321d37c4ebf6e81f5096f8669e3 (patch) | |
tree | e46b14ed44c35a2123d46d624661e7837dfb713b /ufund-api | |
parent | 24902e734df0a486818950f37452242ada4c656b (diff) | |
download | JellySolutions-d101a0807c1eb321d37c4ebf6e81f5096f8669e3.tar.gz JellySolutions-d101a0807c1eb321d37c4ebf6e81f5096f8669e3.tar.bz2 JellySolutions-d101a0807c1eb321d37c4ebf6e81f5096f8669e3.zip |
Added backend check for empty name field
Diffstat (limited to 'ufund-api')
-rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java | 4 |
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 859194a..33b272b 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 @@ -41,6 +41,8 @@ public class CupboardService { 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"); + } else if (name == null || name.isEmpty()) { + throw new IllegalArgumentException("Required fields cannot be blank"); } for (Need searchNeed : cupboardDAO.getNeeds()) { @@ -103,6 +105,8 @@ public class CupboardService { 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"); + } else if (need.getName() == null || need.getName().isEmpty()) { + throw new IllegalArgumentException("Required fields cannot be blank"); } return cupboardDAO.updateNeed(need); } |