aboutsummaryrefslogtreecommitdiff
path: root/ufund-api
diff options
context:
space:
mode:
Diffstat (limited to 'ufund-api')
-rw-r--r--ufund-api/data/cupboard.json2
-rw-r--r--ufund-api/data/userAuths.json2
-rw-r--r--ufund-api/data/users.json2
-rw-r--r--ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java6
-rw-r--r--ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java16
-rw-r--r--ufund-api/src/main/java/com/ufund/api/ufundapi/service/CupboardService.java8
-rw-r--r--ufund-api/src/test/java/com/ufund/api/ufundapi/controller/CupboardControllerTest.java82
-rw-r--r--ufund-api/src/test/java/com/ufund/api/ufundapi/model/NeedTest.java24
-rw-r--r--ufund-api/src/test/java/com/ufund/api/ufundapi/model/UserTest.java6
-rw-r--r--ufund-api/src/test/java/com/ufund/api/ufundapi/persistence/CupboardFileDAOTest.java12
-rw-r--r--ufund-api/src/test/java/com/ufund/api/ufundapi/service/CupboardServiceTest.java40
11 files changed, 141 insertions, 59 deletions
diff --git a/ufund-api/data/cupboard.json b/ufund-api/data/cupboard.json
index 3d49031..0e3917f 100644
--- a/ufund-api/data/cupboard.json
+++ b/ufund-api/data/cupboard.json
@@ -1 +1 @@
-[{"name":"Pollution Filters","location":"New York Harbor","id":5,"maxGoal":1000.0,"type":"PHYSICAL","urgent":true,"filterAttributes":null,"current":0.0},{"name":"Diving Equipment","location":"Gulf of Mexico","id":6,"maxGoal":50.0,"type":"PHYSICAL","urgent":false,"filterAttributes":null,"current":0.0},{"name":"Life Straw","location":"RIT","id":7,"maxGoal":1.0,"type":"PHYSICAL","urgent":false,"filterAttributes":null,"current":0.0},{"name":"Dog Fish research","location":"RIT","id":8,"maxGoal":1000000.0,"type":"MONETARY","urgent":true,"filterAttributes":null,"current":0.0},{"name":"Jellyfish Glue","location":"Pacific","id":9,"maxGoal":100000.0,"type":"MONETARY","urgent":false,"filterAttributes":null,"current":0.0},{"name":"Fish Food","location":"","id":10,"maxGoal":1000.0,"type":"MONETARY","urgent":true,"filterAttributes":null,"current":0.0},{"name":"Harpoons","location":"Atlantic City","id":11,"maxGoal":900.0,"type":"PHYSICAL","urgent":false,"filterAttributes":null,"current":0.0},{"name":"Sea Urchin Hats","location":"Seaworld","id":12,"maxGoal":90.0,"type":"PHYSICAL","urgent":true,"filterAttributes":null,"current":0.0},{"name":"Awareness Exhibit","location":"Seneca Park Zoo","id":13,"maxGoal":1.0E7,"type":"MONETARY","urgent":false,"filterAttributes":null,"current":0.0},{"name":"New Whale","location":"Seneca Park Zoo","id":14,"maxGoal":1.0,"type":"PHYSICAL","urgent":false,"filterAttributes":null,"current":0.0},{"name":"New Gosnell Algae Filter","location":"Gosnell College","id":15,"maxGoal":40.0,"type":"MONETARY","urgent":true,"filterAttributes":null,"current":0.0},{"name":"Awareness Lunches","location":"Colleges and Highschools","id":16,"maxGoal":5000.0,"type":"MONETARY","urgent":false,"filterAttributes":null,"current":0.0},{"name":"Fish Column for RIT Tours","location":"Wallace Library","id":17,"maxGoal":2.0E7,"type":"MONETARY","urgent":false,"filterAttributes":null,"current":0.0},{"name":"Submarine Matinience","location":"New York Harbor","id":18,"maxGoal":1000000.0,"type":"MONETARY","urgent":true,"filterAttributes":null,"current":0.0},{"name":"Volunteer Lunches ","location":"Lake Ontario","id":19,"maxGoal":150.0,"type":"PHYSICAL","urgent":false,"filterAttributes":null,"current":0.0},{"name":"Volunteer Misc. Equipment","location":"Lake Ontario","id":20,"maxGoal":2500.0,"type":"MONETARY","urgent":true,"filterAttributes":null,"current":0.0},{"name":"Invasive eel removal","location":"Pacific Seafloor","id":21,"maxGoal":1.0E8,"type":"MONETARY","urgent":true,"filterAttributes":null,"current":0.0},{"name":"Fishing Liscense Enforcement","location":"Rochester Bridges","id":22,"maxGoal":10000.0,"type":"MONETARY","urgent":false,"filterAttributes":null,"current":0.0},{"name":"Waste Runoff Management","location":"RIT Watershed","id":23,"maxGoal":98000.0,"type":"MONETARY","urgent":true,"filterAttributes":null,"current":0.0},{"name":"Lobbying for anti-dynamite fishing legislation","location":"Washington DC","id":24,"maxGoal":50000.0,"type":"MONETARY","urgent":false,"filterAttributes":null,"current":0.0},{"name":"Lobbying for better fishing practice legislation","location":"Washington DC","id":25,"maxGoal":65000.0,"type":"MONETARY","urgent":false,"filterAttributes":null,"current":0.0},{"name":"Bioluminescence Tunnel","location":"Golisano College of Computing","id":26,"maxGoal":2.8E7,"type":"MONETARY","urgent":true,"filterAttributes":null,"current":0.0},{"name":"Pollution awareness campain","location":"Middle and Highschools","id":27,"maxGoal":35000.0,"type":"MONETARY","urgent":false,"filterAttributes":null,"current":0.0}] \ No newline at end of file
+[{"name":"Pollution Filters","location":"New York Harbor","id":5,"maxGoal":1000.0,"type":"PHYSICAL","urgent":true,"filterAttributes":[],"current":0.0,"description":"One thousand heavy duty pollution filters need to be installed as soon as possible throughout the new york harbor."},{"name":"Diving Equipment","location":"Gulf of Mexico","id":6,"maxGoal":120000.0,"type":"MONETARY","urgent":false,"filterAttributes":[],"current":0.0,"description":"Our research team in mexico needs new deep sea rated equipment to continue their research on the ecosystem! Until the equipment funding is fully reached and gear installed, no more progress can be made."},{"name":"Dog Fish research","location":"RIT","id":8,"maxGoal":1000000.0,"type":"MONETARY","urgent":true,"filterAttributes":[],"current":0.0,"description":"Dog Fish are a very interesting species that many research facilities are not researching. The funding will go towards starting research papers on the species."},{"name":"Fish Food Promotion","location":"","id":10,"maxGoal":1000.0,"type":"MONETARY","urgent":true,"filterAttributes":[],"current":0.0,"description":"The money will be spent on a small advertising campaign at a local pet store, where free fish food will be given out to people willing to listen to our cause."},{"name":"Harpoons","location":"Atlantic City","id":11,"maxGoal":25.0,"type":"PHYSICAL","urgent":false,"filterAttributes":[],"current":0.0,"description":"Harpoons are needed for an upcoming whaling museum exhibit. We aren't picky, and need any harpoons that would be interesting for display. We are accepting any harpoons at least 30 years old, but the older the better."},{"name":"Sea Urchin Hats","location":"Seaworld","id":12,"maxGoal":90.0,"type":"PHYSICAL","urgent":true,"filterAttributes":[],"current":0.0,"description":"Seaworld's sea urchins will be wearing your hats as a part of a promo! Hats donated will be used as a part of an awareness exhibit at Seaworld."},{"name":"Awareness Exhibit","location":"Seneca Park Zoo","id":13,"maxGoal":1.0E7,"type":"MONETARY","urgent":false,"filterAttributes":[],"current":0.0,"description":"Getting the Jelly Solutions message out is our top priority. We would like to open a large exhibit featuring all the endangered species due to climate change, overfishing, and pollution. Sadly, this wouldn't be cheap as we want to really get the message across to visitors through different animals, scenes, info boards, and videos."},{"name":"New Whale","location":"Seneca Park Zoo","id":14,"maxGoal":1.0,"type":"PHYSICAL","urgent":false,"filterAttributes":[],"current":0.0,"description":"Seneca park zoo needs a new whale for the upcoming promotional exhibit! The zoo will provide a commemorative plaque for the donor."},{"name":"New Gosnell Algae Filter","location":"Gosnell College","id":15,"maxGoal":40.0,"type":"MONETARY","urgent":true,"filterAttributes":[],"current":0.0,"description":"The Gosnell College fish tank gets way to dirty way too quickly. $40 surely could replace the filter with a more effective one."},{"name":"Awareness Lunches","location":"Colleges and Highschools","id":16,"maxGoal":5000.0,"type":"MONETARY","urgent":false,"filterAttributes":[],"current":0.0,"description":"College and Highschool students would be great recruits for our volunteer events. The lunches would promote our cause and demonstrate ways that they could easily contribute to the movement."},{"name":"Fish Column for RIT Tours","location":"Wallace Library","id":17,"maxGoal":2.0E7,"type":"MONETARY","urgent":false,"filterAttributes":[],"current":0.0,"description":"RIT tours always run through Wallace Library into the SHED. What better way to encourage students to attend the college than a massive aquarium column? This would not only encourage students to join RIT, and could also raise awareness for our cause."},{"name":"Submarine Matinience","location":"New York Harbor","id":18,"maxGoal":1000000.0,"type":"MONETARY","urgent":true,"filterAttributes":[],"current":0.0,"description":"Submarines are necessary tools that many other needs cannot function without. These urgent repairs need to happen as soon as possible."},{"name":"Volunteering for Volunteer Lunches ","location":"Lake Ontario","id":19,"maxGoal":5.0,"type":"PHYSICAL","urgent":false,"filterAttributes":[],"current":0.0,"description":"We need staff to help organize our awareness lunches! The lunches will recruit interested people into volunteering for upcoming events and cleanups."},{"name":"Volunteer Misc. Equipment","location":"Lake Ontario","id":20,"maxGoal":2500.0,"type":"MONETARY","urgent":true,"filterAttributes":[],"current":0.0,"description":"$2500 is needed to cover the unforeseen costs of the upcoming beach cleanup. The money will be spent on nets and other tools for volunteers."},{"name":"Invasive eel removal","location":"Pacific Seafloor","id":21,"maxGoal":1.0E8,"type":"MONETARY","urgent":true,"filterAttributes":[],"current":0.0,"description":"The population of invasive eels are destroying ecosystems. We need to remove these eels and restore balance to these ecosystems as soon as possible."},{"name":"Fishing Liscense Enforcement","location":"Rochester Bridges","id":22,"maxGoal":10000.0,"type":"MONETARY","urgent":false,"filterAttributes":[],"current":0.0,"description":"Rochester citizens won't stop fishing off bridges no matter how many times we ask. The funding will go to increased enforcement of fishing licenses in delegated stocked areas."},{"name":"Waste Runoff Management","location":"RIT Watershed","id":23,"maxGoal":98000.0,"type":"MONETARY","urgent":true,"filterAttributes":[],"current":0.0,"description":"Waste runoff into the protected watershed near RIT is a consistent issue. We need funding to research how to best solve this problem."},{"name":"Lobbying for anti-dynamite fishing legislation","location":"Washington DC","id":24,"maxGoal":50000.0,"type":"MONETARY","urgent":false,"filterAttributes":[],"current":0.0,"description":"Dynamite fishing destroys ecosystems. Legislation needs to be passed as soon as possible! However, lobbyists aren't cheap. Any support to the fund would be greatly appreciated."},{"name":"Bioluminescence Tunnel","location":"Golisano College of Computing","id":26,"maxGoal":2.8E7,"type":"MONETARY","urgent":true,"filterAttributes":[],"current":0.0,"description":"Golisano needs a biolumenescence tunnel! The addition would be costly, but would make the building much more interesting to be in. People sometimes complain about the way the building feels, and this would be a great way to fix that."}] \ No newline at end of file
diff --git a/ufund-api/data/userAuths.json b/ufund-api/data/userAuths.json
index b703ae2..f86b1a4 100644
--- a/ufund-api/data/userAuths.json
+++ b/ufund-api/data/userAuths.json
@@ -1 +1 @@
-[{"key":"3fdd4e7e-bc59-4e3a-ba5c-177d0833022a","username":"sowgro","expiration":"2025-04-14T18:35:26.42935739"},{"key":"5d0182e2-247e-4b4e-b165-cd95710c2402","username":"phil","expiration":"2025-04-17T08:17:09.1886771"},{"key":"13d12a6d-6825-4c1d-8b22-ba960de140b8","username":"phil","expiration":"2025-04-14T17:20:58.531711142"},{"key":"960ef9a5-021d-49a1-a752-ad9dfd8a40f3","username":"phil","expiration":"2025-04-17T10:53:51.2661748"},{"key":"20529784-361d-4111-8b2e-13a23b24d6cc","username":"phil","expiration":"2025-04-17T09:07:11.4534752"},{"key":"342977bc-2095-4325-96d8-ea4cdaa241c6","username":"phil","expiration":"2025-04-17T08:47:07.5445119"},{"key":"e2c17a24-ad11-4e63-8b01-74baf3ae6b4a","username":"phil","expiration":"2025-04-17T10:14:03.2239052"},{"key":"f9f6bc24-7a69-4bfe-92c3-c1166d20f0db","username":"phil","expiration":"2025-04-17T10:50:51.9716943"},{"key":"1dc114a0-f5d7-410e-8664-2ca9af3393ac","username":"phil","expiration":"2025-04-17T09:06:49.5204299"},{"key":"ff1e80a8-344f-4578-9ead-a6d46c8ed1c2","username":"phil","expiration":"2025-04-17T10:51:00.0607854"},{"key":"eeea7b02-7265-4a26-96de-a8ad1860c533","username":"phil","expiration":"2025-03-31T23:04:47.455490668"},{"key":"e121c7c6-e534-4fde-8a78-4f175e9db9c8","username":"phil","expiration":"2025-04-14T17:23:23.218442063"},{"key":"4df8bb43-f597-49ca-863a-6e0da5280d79","username":"phil","expiration":"2025-04-14T01:13:53.799331844"},{"key":"05e8790e-67fa-45de-adfe-82c6f5fdd15b","username":"phil","expiration":"2025-04-17T08:18:05.2696558"},{"key":"4eafe9d9-1b05-4fbd-90f1-c7f856d338dd","username":"phil","expiration":"2025-04-17T09:46:48.0123639"},{"key":"1a9b7e5a-d19c-43ef-bb02-838b6fc695e0","username":"phil","expiration":"2025-04-17T09:37:48.4955941"},{"key":"718be1e2-cfc7-44a6-b3c6-965684d1d0a9","username":"adf","expiration":"2025-04-14T18:35:58.888847176"},{"key":"85319427-4603-4a16-af33-2e9525dda8c0","username":"phil","expiration":"2025-04-14T00:39:34.952183453"},{"key":"f14f187c-355f-444a-88bf-42202f82f947","username":"phil","expiration":"2025-04-17T09:07:05.5541299"},{"key":"004f9f22-2b7e-4448-9c37-7437de47f1e0","username":"phil","expiration":"2025-04-17T08:27:28.3862592"},{"key":"24e8cf17-ad76-45b1-bfb6-79a790035231","username":"admin","expiration":"2025-04-17T08:17:27.7488131"},{"key":"f1d6a110-4232-4ef3-b6ec-9a2962664158","username":"phil","expiration":"2025-04-14T17:23:40.834526839"},{"key":"e48872fa-b89f-494a-b681-11a809d32ff4","username":"phil","expiration":"2025-04-14T17:20:23.265745224"},{"key":"31fcbc15-9902-41d2-8d6f-5b0e40ebddd2","username":"phil","expiration":"2025-04-14T16:45:41.082560826"},{"key":"98c11c42-4e7c-4601-b591-a4af1a5163f9","username":"phil","expiration":"2025-04-17T08:54:04.5078852"},{"key":"27583604-609f-4dac-bb88-01c6035c4142","username":"phil","expiration":"2025-04-17T11:15:56.8479454"},{"key":"967de418-4f86-44ac-b364-eb3a1653aa7d","username":"phil","expiration":"2025-04-17T10:54:19.237888"},{"key":"f20b64c5-a7ed-48c0-a813-6d9802cf9109","username":"phil","expiration":"2025-04-17T08:41:02.6531587"},{"key":"10ea39c2-3869-47da-8630-87b21a88681d","username":"phil","expiration":"2025-04-17T08:45:33.1781528"},{"key":"92d0d6cb-ceb0-4f84-bab3-d959dfb5df9d","username":"phil","expiration":"2025-04-17T08:30:04.2567034"},{"key":"7a7d2e8b-4242-4c18-b7dd-d0565ab5c725","username":"phil","expiration":"2025-04-17T10:10:44.3380846"},{"key":"e14f8ee5-5780-4b9b-bf34-7a41c2bbfcb4","username":"phil","expiration":"2025-04-05T13:46:10.90733016"},{"key":"e1905fc6-ca86-43d7-b1e7-60d458c75a04","username":"phil","expiration":"2025-04-17T09:12:05.990995"},{"key":"a1417644-2b43-4a18-bf5a-26bf3b7ac1fc","username":"phil","expiration":"2025-04-17T10:23:26.122743"},{"key":"7e312d55-bf3e-4dc3-b44a-74d8be591287","username":"phil","expiration":"2025-04-17T10:56:38.9103348"},{"key":"af38add5-b100-4b96-9ffb-5afaccd59979","username":"adf","expiration":"2025-04-14T18:18:47.670506361"},{"key":"4ae3922b-7d5d-45c2-83eb-f8c77e3ce218","username":"phil","expiration":"2025-04-17T08:18:53.5158112"},{"key":"0eb494c8-2fa4-4ef4-915d-4b9fcb3c75ef","username":"phil","expiration":"2025-04-17T08:24:20.412242"},{"key":"0d81e2b4-d9f2-4bc0-b93f-084c086e3707","username":"phil","expiration":"2025-04-17T08:52:41.0723771"},{"key":"04900729-cdcf-4758-9c6e-4f70f03ddb86","username":"phil","expiration":"2025-04-17T11:15:05.0632779"},{"key":"0c8da4b1-bca8-42df-a5b6-65023eadab05","username":"phil","expiration":"2025-04-17T08:15:37.7698648"},{"key":"a3703b55-c7fd-4c5a-9b6a-160c1906aa1a","username":"phil","expiration":"2025-04-17T11:35:39.9101516"},{"key":"ba426671-db67-4d2f-a701-3aa0f284f497","username":"phil","expiration":"2025-04-17T08:54:43.230802"},{"key":"639ea3fa-854a-4052-b1cf-80ea1d3d5917","username":"phil","expiration":"2025-04-17T09:38:47.9716959"},{"key":"a1825159-2e62-48a3-beba-74a3daaca5b5","username":"phil","expiration":"2025-04-17T08:12:28.2166599"},{"key":"799ed420-e843-4777-8c1a-c6d061cca773","username":"phil","expiration":"2025-04-17T08:39:38.8493536"},{"key":"cdd4df80-8139-4479-86ec-953190796d7b","username":"phil","expiration":"2025-04-17T10:02:07.6745458"},{"key":"3d3fb646-9954-496b-98bf-73136c7792ea","username":"phil","expiration":"2025-04-17T10:04:11.7737565"},{"key":"da61796e-402a-4a80-88ae-7607a37989a4","username":"phil","expiration":"2025-04-14T17:07:10.618039573"},{"key":"3beac724-e9f9-4969-9634-60826ad9db43","username":"phil","expiration":"2025-04-17T11:20:36.8424562"},{"key":"0d6e6910-b5dc-45ae-ba8e-c28604939f83","username":"phil","expiration":"2025-04-17T11:19:21.9682553"},{"key":"b7b403a0-d81f-4f7d-bd28-ccf3e2ac706b","username":"phil","expiration":"2025-04-17T10:28:53.9964744"},{"key":"125a4847-3a1c-4834-961f-7f96e997f92e","username":"sowgro","expiration":"2025-04-14T18:35:38.922687686"},{"key":"ce4accc3-0fa8-40fc-a480-1290d12caaed","username":"phil","expiration":"2025-04-17T09:12:58.9504986"},{"key":"adc5ce2f-5a40-4ee5-b9a6-6154860e6861","username":"phil","expiration":"2025-04-17T08:28:48.4584821"},{"key":"2aeaab28-99c9-4b45-bdef-82096c70945e","username":"phil","expiration":"2025-04-14T17:19:48.552121268"},{"key":"7805de89-9b38-46dc-8f59-09c06ef9d2dd","username":"phil","expiration":"2025-04-17T08:52:44.6283659"},{"key":"ad6d92d4-c496-407c-823a-edaa386e67ed","username":"phil","expiration":"2025-04-14T17:07:36.032623002"},{"key":"fbdf7ac2-cf01-4dad-baec-ed9310a4eba7","username":"phil","expiration":"2025-04-17T08:38:12.8162926"},{"key":"7907ccb2-bf01-4962-a280-ebb6aa9c5b20","username":"phil","expiration":"2025-04-17T09:45:01.6777324"},{"key":"a69796dd-734c-4545-ac91-e5fe0387d0ad","username":"phil","expiration":"2025-04-17T08:29:32.671782"},{"key":"9f3e380d-fead-4d40-a1c0-278e857dd674","username":"phil","expiration":"2025-04-17T08:52:29.4148814"},{"key":"efc531fb-ab24-4d5a-a2f5-7f4ede74819f","username":"phil","expiration":"2025-04-13T19:41:51.017327545"},{"key":"88b539a9-3986-41b4-a6ed-a79672042ccf","username":"phil","expiration":"2025-04-17T08:23:45.5712888"},{"key":"68bc53af-e21a-4364-adf5-8f163f642235","username":"phil","expiration":"2025-04-17T08:24:43.3201656"},{"key":"a07ae51f-f80b-4001-95f1-48c11d4917a4","username":"phil","expiration":"2025-04-05T15:04:30.900359001"},{"key":"cc49c007-fd36-4828-b8fa-f5b85ad0676d","username":"phil","expiration":"2025-04-14T16:46:12.80566798"},{"key":"fb2d7dd5-783e-47d8-9a43-8b7693c5f070","username":"phil","expiration":"2025-04-17T11:13:05.9489267"},{"key":"49a0ad40-3223-4f62-94e8-0f9e96241a85","username":"phil","expiration":"2025-04-17T09:13:39.9633546"},{"key":"db53acf2-61d1-45ea-9d01-5c710b80bdaf","username":"phil","expiration":"2025-04-17T08:53:47.487545"},{"key":"d7cef571-0f76-49fe-941f-ecbeae69557a","username":"phil","expiration":"2025-04-05T15:14:00.363201102"},{"key":"3fc557b6-0306-4779-9b74-b7292a5cf1cc","username":"phil","expiration":"2025-04-14T16:06:08.564069822"},{"key":"77392d17-6e0c-45ec-857d-6595a55ddd97","username":"phil","expiration":"2025-04-14T16:06:48.335542315"},{"key":"58e4e2a2-3a36-4fd6-8bb1-ad0831664d01","username":"phil","expiration":"2025-04-12T23:17:42.638952959"},{"key":"6083ae1d-a761-4ed3-8c48-a429afa2c521","username":"phil","expiration":"2025-04-17T08:32:25.3500545"},{"key":"1c438301-e8f5-4c12-a40b-e20b8a282814","username":"keshey","expiration":"2025-04-17T10:26:04.7690496"},{"key":"fe2146e2-7982-4226-b215-96879939f485","username":"phil","expiration":"2025-04-17T08:34:59.3412483"},{"key":"6d2ea170-50aa-4c48-9247-9310a29ae753","username":"phil","expiration":"2025-04-17T11:29:10.0637357"},{"key":"f5f53053-ef5e-4850-93a0-3dc20646f78b","username":"sowgro","expiration":"2025-04-14T18:11:29.438554549"},{"key":"03424ad1-376c-47aa-8553-7f2ea8099d45","username":"phil","expiration":"2025-04-17T08:05:35.7264696"},{"key":"568e4738-70b5-4be7-bfa6-1367cd22ce3f","username":"admin","expiration":"2025-04-17T08:16:59.0542222"},{"key":"7a634e0a-628b-4b31-8950-dc33d4ee5d95","username":"phil","expiration":"2025-04-17T08:15:47.1663258"},{"key":"9c6a36b8-7f71-4b09-b26b-682f1f0be4cb","username":"phil","expiration":"2025-04-17T09:12:15.5425885"},{"key":"f6951471-2578-4a6a-b3e5-b7e97ed9207a","username":"phil","expiration":"2025-04-17T10:23:45.9450825"},{"key":"cb658550-aafc-4a45-89be-f7899e44d7ba","username":"phil","expiration":"2025-04-17T10:50:40.0249774"}] \ No newline at end of file
+[{"key":"3fdd4e7e-bc59-4e3a-ba5c-177d0833022a","username":"sowgro","expiration":"2025-04-14T18:35:26.42935739"},{"key":"5d0182e2-247e-4b4e-b165-cd95710c2402","username":"phil","expiration":"2025-04-17T08:17:09.1886771"},{"key":"13d12a6d-6825-4c1d-8b22-ba960de140b8","username":"phil","expiration":"2025-04-14T17:20:58.531711142"},{"key":"960ef9a5-021d-49a1-a752-ad9dfd8a40f3","username":"phil","expiration":"2025-04-17T10:53:51.2661748"},{"key":"20529784-361d-4111-8b2e-13a23b24d6cc","username":"phil","expiration":"2025-04-17T09:07:11.4534752"},{"key":"342977bc-2095-4325-96d8-ea4cdaa241c6","username":"phil","expiration":"2025-04-17T08:47:07.5445119"},{"key":"e2c17a24-ad11-4e63-8b01-74baf3ae6b4a","username":"phil","expiration":"2025-04-17T10:14:03.2239052"},{"key":"f9f6bc24-7a69-4bfe-92c3-c1166d20f0db","username":"phil","expiration":"2025-04-17T10:50:51.9716943"},{"key":"1dc114a0-f5d7-410e-8664-2ca9af3393ac","username":"phil","expiration":"2025-04-17T09:06:49.5204299"},{"key":"ff1e80a8-344f-4578-9ead-a6d46c8ed1c2","username":"phil","expiration":"2025-04-17T10:51:00.0607854"},{"key":"eeea7b02-7265-4a26-96de-a8ad1860c533","username":"phil","expiration":"2025-03-31T23:04:47.455490668"},{"key":"e121c7c6-e534-4fde-8a78-4f175e9db9c8","username":"phil","expiration":"2025-04-14T17:23:23.218442063"},{"key":"4df8bb43-f597-49ca-863a-6e0da5280d79","username":"phil","expiration":"2025-04-14T01:13:53.799331844"},{"key":"05e8790e-67fa-45de-adfe-82c6f5fdd15b","username":"phil","expiration":"2025-04-17T08:18:05.2696558"},{"key":"4eafe9d9-1b05-4fbd-90f1-c7f856d338dd","username":"phil","expiration":"2025-04-17T09:46:48.0123639"},{"key":"1a9b7e5a-d19c-43ef-bb02-838b6fc695e0","username":"phil","expiration":"2025-04-17T09:37:48.4955941"},{"key":"718be1e2-cfc7-44a6-b3c6-965684d1d0a9","username":"adf","expiration":"2025-04-14T18:35:58.888847176"},{"key":"85319427-4603-4a16-af33-2e9525dda8c0","username":"phil","expiration":"2025-04-14T00:39:34.952183453"},{"key":"f14f187c-355f-444a-88bf-42202f82f947","username":"phil","expiration":"2025-04-17T09:07:05.5541299"},{"key":"004f9f22-2b7e-4448-9c37-7437de47f1e0","username":"phil","expiration":"2025-04-17T08:27:28.3862592"},{"key":"24e8cf17-ad76-45b1-bfb6-79a790035231","username":"admin","expiration":"2025-04-17T08:17:27.7488131"},{"key":"f1d6a110-4232-4ef3-b6ec-9a2962664158","username":"phil","expiration":"2025-04-14T17:23:40.834526839"},{"key":"e48872fa-b89f-494a-b681-11a809d32ff4","username":"phil","expiration":"2025-04-14T17:20:23.265745224"},{"key":"31fcbc15-9902-41d2-8d6f-5b0e40ebddd2","username":"phil","expiration":"2025-04-14T16:45:41.082560826"},{"key":"98c11c42-4e7c-4601-b591-a4af1a5163f9","username":"phil","expiration":"2025-04-17T08:54:04.5078852"},{"key":"27583604-609f-4dac-bb88-01c6035c4142","username":"phil","expiration":"2025-04-17T11:15:56.8479454"},{"key":"967de418-4f86-44ac-b364-eb3a1653aa7d","username":"phil","expiration":"2025-04-17T10:54:19.237888"},{"key":"f20b64c5-a7ed-48c0-a813-6d9802cf9109","username":"phil","expiration":"2025-04-17T08:41:02.6531587"},{"key":"10ea39c2-3869-47da-8630-87b21a88681d","username":"phil","expiration":"2025-04-17T08:45:33.1781528"},{"key":"92d0d6cb-ceb0-4f84-bab3-d959dfb5df9d","username":"phil","expiration":"2025-04-17T08:30:04.2567034"},{"key":"7a7d2e8b-4242-4c18-b7dd-d0565ab5c725","username":"phil","expiration":"2025-04-17T10:10:44.3380846"},{"key":"e14f8ee5-5780-4b9b-bf34-7a41c2bbfcb4","username":"phil","expiration":"2025-04-05T13:46:10.90733016"},{"key":"e1905fc6-ca86-43d7-b1e7-60d458c75a04","username":"phil","expiration":"2025-04-17T09:12:05.990995"},{"key":"a1417644-2b43-4a18-bf5a-26bf3b7ac1fc","username":"phil","expiration":"2025-04-17T10:23:26.122743"},{"key":"7e312d55-bf3e-4dc3-b44a-74d8be591287","username":"phil","expiration":"2025-04-17T10:56:38.9103348"},{"key":"af38add5-b100-4b96-9ffb-5afaccd59979","username":"adf","expiration":"2025-04-14T18:18:47.670506361"},{"key":"4ae3922b-7d5d-45c2-83eb-f8c77e3ce218","username":"phil","expiration":"2025-04-17T08:18:53.5158112"},{"key":"0eb494c8-2fa4-4ef4-915d-4b9fcb3c75ef","username":"phil","expiration":"2025-04-17T08:24:20.412242"},{"key":"0d81e2b4-d9f2-4bc0-b93f-084c086e3707","username":"phil","expiration":"2025-04-17T08:52:41.0723771"},{"key":"04900729-cdcf-4758-9c6e-4f70f03ddb86","username":"phil","expiration":"2025-04-17T11:15:05.0632779"},{"key":"0c8da4b1-bca8-42df-a5b6-65023eadab05","username":"phil","expiration":"2025-04-17T08:15:37.7698648"},{"key":"a3703b55-c7fd-4c5a-9b6a-160c1906aa1a","username":"phil","expiration":"2025-04-17T11:35:39.9101516"},{"key":"ba426671-db67-4d2f-a701-3aa0f284f497","username":"phil","expiration":"2025-04-17T08:54:43.230802"},{"key":"639ea3fa-854a-4052-b1cf-80ea1d3d5917","username":"phil","expiration":"2025-04-17T09:38:47.9716959"},{"key":"a1825159-2e62-48a3-beba-74a3daaca5b5","username":"phil","expiration":"2025-04-17T08:12:28.2166599"},{"key":"799ed420-e843-4777-8c1a-c6d061cca773","username":"phil","expiration":"2025-04-17T08:39:38.8493536"},{"key":"cdd4df80-8139-4479-86ec-953190796d7b","username":"phil","expiration":"2025-04-17T10:02:07.6745458"},{"key":"3d3fb646-9954-496b-98bf-73136c7792ea","username":"phil","expiration":"2025-04-17T10:04:11.7737565"},{"key":"da61796e-402a-4a80-88ae-7607a37989a4","username":"phil","expiration":"2025-04-14T17:07:10.618039573"},{"key":"3beac724-e9f9-4969-9634-60826ad9db43","username":"phil","expiration":"2025-04-17T11:20:36.8424562"},{"key":"0d6e6910-b5dc-45ae-ba8e-c28604939f83","username":"phil","expiration":"2025-04-17T11:19:21.9682553"},{"key":"b7b403a0-d81f-4f7d-bd28-ccf3e2ac706b","username":"phil","expiration":"2025-04-17T10:28:53.9964744"},{"key":"125a4847-3a1c-4834-961f-7f96e997f92e","username":"sowgro","expiration":"2025-04-14T18:35:38.922687686"},{"key":"ce4accc3-0fa8-40fc-a480-1290d12caaed","username":"phil","expiration":"2025-04-17T09:12:58.9504986"},{"key":"adc5ce2f-5a40-4ee5-b9a6-6154860e6861","username":"phil","expiration":"2025-04-17T08:28:48.4584821"},{"key":"50019b5d-25ad-40fe-bd21-19d4dbe57a92","username":"phil","expiration":"2025-04-29T20:23:12.415416825"},{"key":"2aeaab28-99c9-4b45-bdef-82096c70945e","username":"phil","expiration":"2025-04-14T17:19:48.552121268"},{"key":"7805de89-9b38-46dc-8f59-09c06ef9d2dd","username":"phil","expiration":"2025-04-17T08:52:44.6283659"},{"key":"ad6d92d4-c496-407c-823a-edaa386e67ed","username":"phil","expiration":"2025-04-14T17:07:36.032623002"},{"key":"fbdf7ac2-cf01-4dad-baec-ed9310a4eba7","username":"phil","expiration":"2025-04-17T08:38:12.8162926"},{"key":"7907ccb2-bf01-4962-a280-ebb6aa9c5b20","username":"phil","expiration":"2025-04-17T09:45:01.6777324"},{"key":"904f6de1-10ab-465d-abd8-be0612311251","username":"phil","expiration":"2025-04-29T20:24:45.666998397"},{"key":"a69796dd-734c-4545-ac91-e5fe0387d0ad","username":"phil","expiration":"2025-04-17T08:29:32.671782"},{"key":"9f3e380d-fead-4d40-a1c0-278e857dd674","username":"phil","expiration":"2025-04-17T08:52:29.4148814"},{"key":"efc531fb-ab24-4d5a-a2f5-7f4ede74819f","username":"phil","expiration":"2025-04-13T19:41:51.017327545"},{"key":"88b539a9-3986-41b4-a6ed-a79672042ccf","username":"phil","expiration":"2025-04-17T08:23:45.5712888"},{"key":"68bc53af-e21a-4364-adf5-8f163f642235","username":"phil","expiration":"2025-04-17T08:24:43.3201656"},{"key":"a07ae51f-f80b-4001-95f1-48c11d4917a4","username":"phil","expiration":"2025-04-05T15:04:30.900359001"},{"key":"cc49c007-fd36-4828-b8fa-f5b85ad0676d","username":"phil","expiration":"2025-04-14T16:46:12.80566798"},{"key":"fb2d7dd5-783e-47d8-9a43-8b7693c5f070","username":"phil","expiration":"2025-04-17T11:13:05.9489267"},{"key":"49a0ad40-3223-4f62-94e8-0f9e96241a85","username":"phil","expiration":"2025-04-17T09:13:39.9633546"},{"key":"db53acf2-61d1-45ea-9d01-5c710b80bdaf","username":"phil","expiration":"2025-04-17T08:53:47.487545"},{"key":"d7cef571-0f76-49fe-941f-ecbeae69557a","username":"phil","expiration":"2025-04-05T15:14:00.363201102"},{"key":"25d6a49b-c185-460c-adbe-a874419d20aa","username":"phil","expiration":"2025-04-29T20:22:19.629805123"},{"key":"3fc557b6-0306-4779-9b74-b7292a5cf1cc","username":"phil","expiration":"2025-04-14T16:06:08.564069822"},{"key":"77392d17-6e0c-45ec-857d-6595a55ddd97","username":"phil","expiration":"2025-04-14T16:06:48.335542315"},{"key":"58e4e2a2-3a36-4fd6-8bb1-ad0831664d01","username":"phil","expiration":"2025-04-12T23:17:42.638952959"},{"key":"6083ae1d-a761-4ed3-8c48-a429afa2c521","username":"phil","expiration":"2025-04-17T08:32:25.3500545"},{"key":"1c438301-e8f5-4c12-a40b-e20b8a282814","username":"keshey","expiration":"2025-04-17T10:26:04.7690496"},{"key":"fe2146e2-7982-4226-b215-96879939f485","username":"phil","expiration":"2025-04-17T08:34:59.3412483"},{"key":"6d2ea170-50aa-4c48-9247-9310a29ae753","username":"phil","expiration":"2025-04-17T11:29:10.0637357"},{"key":"f5f53053-ef5e-4850-93a0-3dc20646f78b","username":"sowgro","expiration":"2025-04-14T18:11:29.438554549"},{"key":"03424ad1-376c-47aa-8553-7f2ea8099d45","username":"phil","expiration":"2025-04-17T08:05:35.7264696"},{"key":"568e4738-70b5-4be7-bfa6-1367cd22ce3f","username":"admin","expiration":"2025-04-17T08:16:59.0542222"},{"key":"7a634e0a-628b-4b31-8950-dc33d4ee5d95","username":"phil","expiration":"2025-04-17T08:15:47.1663258"},{"key":"9c6a36b8-7f71-4b09-b26b-682f1f0be4cb","username":"phil","expiration":"2025-04-17T09:12:15.5425885"},{"key":"f6951471-2578-4a6a-b3e5-b7e97ed9207a","username":"phil","expiration":"2025-04-17T10:23:45.9450825"},{"key":"cb658550-aafc-4a45-89be-f7899e44d7ba","username":"phil","expiration":"2025-04-17T10:50:40.0249774"}] \ No newline at end of file
diff --git a/ufund-api/data/users.json b/ufund-api/data/users.json
index 5b2457f..9bddb7d 100644
--- a/ufund-api/data/users.json
+++ b/ufund-api/data/users.json
@@ -1 +1 @@
-[{"username":"keshey","passwordHash":-1134843357,"basket":[],"type":"HELPER"},{"username":"admin","passwordHash":92668751,"basket":[],"type":"MANAGER"},{"username":"phil","passwordHash":-1054080181,"basket":[22,26],"type":"HELPER"}] \ No newline at end of file
+[{"username":"keshey","passwordHash":-1134843357,"basket":[],"type":"HELPER"},{"username":"admin","passwordHash":92668751,"basket":[],"type":"MANAGER"},{"username":"phil","passwordHash":-1054080181,"basket":[],"type":"HELPER"}] \ No newline at end of file
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java
index cce016c..12fb0a9 100644
--- a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java
+++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/CupboardController.java
@@ -5,7 +5,6 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
-import com.ufund.api.ufundapi.service.AuthService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
@@ -22,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.ufund.api.ufundapi.DuplicateKeyException;
import com.ufund.api.ufundapi.model.Need;
import com.ufund.api.ufundapi.model.Need.GoalType;
+import com.ufund.api.ufundapi.service.AuthService;
import com.ufund.api.ufundapi.service.CupboardService;
@RestController
@@ -55,14 +55,16 @@ public class CupboardController {
LOG.log(Level.INFO, "POST /cupboard body={0}", params);
String name = (String) params.get("name");
+ String image = (String) params.get("image");
String location = (String) params.get("location");
double maxGoal = ((Number) params.get("maxGoal")).doubleValue();
boolean urgent = (Boolean) params.get("urgent");
+ String description = (String) params.get("description");
Need.GoalType goalType = GoalType.valueOf((String) params.get("type"));
try {
authService.keyHasAccessToCupboard(key);
- Need need = cupboardService.createNeed(name, location, maxGoal, goalType, urgent);
+ Need need = cupboardService.createNeed(name, image, location, maxGoal, goalType, urgent, description);
return new ResponseEntity<>(need, HttpStatus.OK);
} catch (DuplicateKeyException ex) {
LOG.log(Level.WARNING, ex.getLocalizedMessage());
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java
index 55a9441..9b6170b 100644
--- a/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java
+++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/model/Need.java
@@ -10,6 +10,7 @@ public class Need {
}
@JsonProperty("name") private String name;
+ @JsonProperty("image") private String image;
@JsonProperty("location") private String location;
@JsonProperty("id") private int id;
@JsonProperty("filterAttributes") private String[] filterAttributes;
@@ -17,6 +18,7 @@ public class Need {
@JsonProperty("maxGoal") private double maxGoal;
@JsonProperty("urgent") private boolean urgent;
@JsonProperty("current") private double current;
+ @JsonProperty("description") private String description;
/**
* Create a new need, used by the controller
@@ -27,31 +29,38 @@ public class Need {
* @param maxGoal The maximum goal for this need
* @param type The type of need (monetary, physical)
* @param urgent The urgency of the need
+ * @param description The description of the need
*/
- public Need(@JsonProperty("name") String name, @JsonProperty("location") String location, @JsonProperty("id") int id, @JsonProperty("maxGoal") double maxGoal, @JsonProperty("type") GoalType type, @JsonProperty("urgent") boolean urgent) {
+ public Need(@JsonProperty("name") String name, @JsonProperty("image") String image, @JsonProperty("location") String location, @JsonProperty("id") int id, @JsonProperty("maxGoal") double maxGoal, @JsonProperty("type") GoalType type, @JsonProperty("urgent") boolean urgent, @JsonProperty("Description") String description) {
this.id = id;
+ this.image = image;
this.location = location;
this.name = name;
this.maxGoal = maxGoal;
this.type = type;
this.urgent = urgent;
+ this.description = description;
}
/**
* Create a new need
*
* @param name The name of the need
+ * @param image The image representation of the need
* @param location The location of the need
* @param maxGoal The maximum goal for this need
* @param type The type of need (monetary, physical)
* @param urgent The urgency of the need
+ * @param description The description of the need
*/
- public Need(String name, String location, double maxGoal, GoalType type, boolean urgent) {
+ public Need(String name, String image, String location, double maxGoal, GoalType type, boolean urgent, String description) {
this.name = name;
+ this.image = image;
this.location = location;
this.type = type;
this.maxGoal = maxGoal;
this.urgent = urgent;
+ this.description = description;
}
/**
@@ -61,6 +70,7 @@ public class Need {
*/
public Need(Need other) {
this.name = other.name;
+ this.image = other.image;
this.location = other.location;
this.id = other.id;
this.filterAttributes = other.filterAttributes;
@@ -68,6 +78,7 @@ public class Need {
this.maxGoal = other.maxGoal;
this.current = other.current;
this.urgent = other.urgent;
+ this.description = other.description;
}
public String getName() {
@@ -94,6 +105,7 @@ public class Need {
return current;
}
+
public void setCurrent(double current) {
this.current = current;
}
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 a86fe28..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
@@ -25,13 +25,17 @@ public class CupboardService {
* Creates a new Need
*
* @param name The name of the need to create
+ * @param image The image representation of the need to create
+ * @param location The location of the new need
* @param maxGoal The max goal of the new need
* @param goalType The goal type of the new need
+ * @param urgent The urgency of the new need
+ * @param description The description of the new need
* @return The need that was created
* @throws IOException Thrown if there was any issue saving the data
* @throws DuplicateKeyException If there already exists a need with the same name
*/
- public Need createNeed(String name, String location, double maxGoal, Need.GoalType goalType, boolean urgent) throws IOException, DuplicateKeyException {
+ public Need createNeed(String name, String image, String location, double maxGoal, Need.GoalType goalType, boolean urgent, String description) throws IOException, DuplicateKeyException {
if (maxGoal <= 0) {
throw new IllegalArgumentException("Max Goal must be greater than zero");
@@ -45,7 +49,7 @@ public class CupboardService {
}
}
- Need need = new Need(name, location, maxGoal, goalType, urgent);
+ Need need = new Need(name, image, location, maxGoal, goalType, urgent, description);
return cupboardDAO.addNeed(need);
}
diff --git a/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/CupboardControllerTest.java b/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/CupboardControllerTest.java
index c159db4..8572ec6 100644
--- a/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/CupboardControllerTest.java
+++ b/ufund-api/src/test/java/com/ufund/api/ufundapi/controller/CupboardControllerTest.java
@@ -43,16 +43,20 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
- when(mockCupboardService.createNeed(name, "Atlantis", maxGoal, type, false)).thenReturn(need);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
+ when(mockCupboardService.createNeed(name, image, location, maxGoal, type, urgent, description)).thenReturn(need);
Map<String, Object> needMap = Map.ofEntries(
entry("name", "Test"),
+ entry("image", ""),
entry("location", "Atlantis"),
- entry("maxGoal", 100.0),
+ entry("maxGoal", 100),
entry("type", "MONETARY"),
- entry("urgent", false)
+ entry("urgent", false),
+ entry("description", "")
);
var res = cupboardController.createNeed(needMap, key);
@@ -63,14 +67,16 @@ public class CupboardControllerTest {
@Test
public void createNeedBadMaxGoal() throws IOException, DuplicateKeyException {
- when(mockCupboardService.createNeed("Test", "Atlantis", -100, Need.GoalType.MONETARY, false)).thenThrow(new IllegalArgumentException());
+ when(mockCupboardService.createNeed("Test", "", "Atlantis", -100, Need.GoalType.MONETARY, false, "")).thenThrow(new IllegalArgumentException());
Map<String, Object> needMap = Map.ofEntries(
entry("name", "Test"),
+ entry("image", ""),
entry("location", "Atlantis"),
entry("maxGoal", -100),
entry("type", "MONETARY"),
- entry("urgent", false)
+ entry("urgent", false),
+ entry("description", "")
);
var res = cupboardController.createNeed(needMap, key);
@@ -80,14 +86,16 @@ public class CupboardControllerTest {
@Test
public void createNeedIOException() throws IOException, DuplicateKeyException {
- when(mockCupboardService.createNeed("Test", "Atlantis", 100, Need.GoalType.MONETARY, false)).thenThrow(new IOException());
+ when(mockCupboardService.createNeed("Test", "", "Atlantis", 100, Need.GoalType.MONETARY, false, "")).thenThrow(new IOException());
Map<String, Object> needMap = Map.ofEntries(
entry("name", "Test"),
+ entry("image", ""),
entry("location", "Atlantis"),
entry("maxGoal", 100),
entry("type", "MONETARY"),
- entry("urgent", false)
+ entry("urgent", false),
+ entry("description", "")
);
var res = cupboardController.createNeed(needMap, key);
@@ -97,14 +105,16 @@ public class CupboardControllerTest {
@Test
public void createNeedConflict() throws IOException, DuplicateKeyException {
- when(mockCupboardService.createNeed("Test", "Atlantis", 100, Need.GoalType.MONETARY, false)).thenThrow(new DuplicateKeyException(""));
+ when(mockCupboardService.createNeed("Test", "", "Atlantis", 100, Need.GoalType.MONETARY, false, "")).thenThrow(new DuplicateKeyException(""));
Map<String, Object> needMap = Map.ofEntries(
entry("name", "Test"),
+ entry("image", ""),
entry("location", "Atlantis"),
entry("maxGoal", 100),
entry("type", "MONETARY"),
- entry("urgent", false)
+ entry("urgent", false),
+ entry("description", "")
);
var res = cupboardController.createNeed(needMap, key);
@@ -136,7 +146,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
when(mockCupboardService.getNeeds()).thenReturn(new Need[]{need});
var res = cupboardController.getNeeds();
@@ -171,7 +183,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
when(mockCupboardService.searchNeeds("Na")).thenReturn(new Need[]{need});
var res = cupboardController.searchNeeds("Na");
@@ -206,7 +220,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
when(mockCupboardService.getNeed(need.getId())).thenReturn(need);
var res = cupboardController.getNeed(need.getId());
@@ -222,7 +238,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
when(mockCupboardService.getNeed(need.getId())).thenThrow(new IOException());
var res = cupboardController.getNeed(need.getId());
@@ -237,7 +255,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
when(mockCupboardService.getNeed(need.getId())).thenReturn(null);
var res = cupboardController.getNeed(need.getId());
@@ -253,7 +273,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
when(mockCupboardService.updateNeed(need, 1)).thenReturn(need);
var res = cupboardController.updateNeed(need, 1, key);
@@ -269,7 +291,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
when(mockCupboardService.updateNeed(need, 1)).thenThrow(new IOException());
var res = cupboardController.updateNeed(need, 1, key);
@@ -284,7 +308,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
when(mockCupboardService.updateNeed(need, 1)).thenReturn(null);
var res = cupboardController.updateNeed(need, 1, key);
@@ -299,7 +325,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
when(mockCupboardService.updateNeed(need, 1)).thenThrow(new IllegalArgumentException());
var res = cupboardController.updateNeed(need, 1, key);
@@ -314,7 +342,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
doThrow(new IllegalAccessException()).when(mockAuthService).keyHasAccessToCupboard(key);
var res = cupboardController.updateNeed(need, 1, key);
@@ -329,7 +359,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
when(mockCupboardService.getNeed(1)).thenReturn(need);
when(mockCupboardService.deleteNeed(1)).thenReturn(true);
@@ -355,7 +387,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
when(mockCupboardService.getNeed(1)).thenReturn(need);
doThrow(new IllegalAccessException()).when(mockAuthService).keyHasAccessToCupboard(key);
@@ -371,7 +405,9 @@ public class CupboardControllerTest {
int maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
when(mockCupboardService.getNeed(1)).thenReturn(need);
when(mockCupboardService.deleteNeed(1)).thenThrow(new IOException());
diff --git a/ufund-api/src/test/java/com/ufund/api/ufundapi/model/NeedTest.java b/ufund-api/src/test/java/com/ufund/api/ufundapi/model/NeedTest.java
index c7d17c7..67d2b8f 100644
--- a/ufund-api/src/test/java/com/ufund/api/ufundapi/model/NeedTest.java
+++ b/ufund-api/src/test/java/com/ufund/api/ufundapi/model/NeedTest.java
@@ -18,7 +18,9 @@ public class NeedTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
assertNotNull(need);
}
@@ -29,7 +31,9 @@ public class NeedTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
assertEquals(name, need.getName());
@@ -45,7 +49,9 @@ public class NeedTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
double current = 0.00;
need.setCurrent(current);
@@ -69,7 +75,9 @@ public class NeedTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
String[] filterAttributes = {"seaweed", "divers", "pacific", "plankton"};
@@ -86,7 +94,9 @@ public class NeedTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
double newGoal = 200.00;
need.setMaxGoal(newGoal);
@@ -103,7 +113,9 @@ public class NeedTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, location, image, maxGoal, type, urgent, description);
String newName = "TESTINGFUN";
need.setName(newName);
diff --git a/ufund-api/src/test/java/com/ufund/api/ufundapi/model/UserTest.java b/ufund-api/src/test/java/com/ufund/api/ufundapi/model/UserTest.java
index 01b558c..ed48f54 100644
--- a/ufund-api/src/test/java/com/ufund/api/ufundapi/model/UserTest.java
+++ b/ufund-api/src/test/java/com/ufund/api/ufundapi/model/UserTest.java
@@ -52,7 +52,7 @@ public class UserTest {
String expectedName = "Bob";
User user = User.create(expectedName, "pass");
- Need need = new Need("Test", "Atlantis", 0, 100, Need.GoalType.MONETARY, false);
+ Need need = new Need("Test", "", "Atlantis", 0, 100, Need.GoalType.MONETARY, false, "");
Need[] needs = { need };
when(cupboardService.getNeed(0)).thenReturn(need);
@@ -71,8 +71,8 @@ public class UserTest {
String expectedName = "Bob";
User user = User.create(expectedName, "pass");
- Need need = new Need("Test", "Atlantis", 0, 100, Need.GoalType.MONETARY, false);
- Need need2 = new Need("Test2", "Atlantis", 0, 100, Need.GoalType.MONETARY, false);
+ Need need = new Need("Test", "", "Atlantis", 0, 100, Need.GoalType.MONETARY, false, "");
+ Need need2 = new Need("Test2", "", "Atlantis", 0, 100, Need.GoalType.MONETARY, false, "");
when(cupboardService.getNeed(0)).thenReturn(need2);
user.addToBasket(need);
diff --git a/ufund-api/src/test/java/com/ufund/api/ufundapi/persistence/CupboardFileDAOTest.java b/ufund-api/src/test/java/com/ufund/api/ufundapi/persistence/CupboardFileDAOTest.java
index acb759a..76a8b40 100644
--- a/ufund-api/src/test/java/com/ufund/api/ufundapi/persistence/CupboardFileDAOTest.java
+++ b/ufund-api/src/test/java/com/ufund/api/ufundapi/persistence/CupboardFileDAOTest.java
@@ -28,9 +28,9 @@ public class CupboardFileDAOTest {
public void setupCupboardFileDao() throws IOException {
ObjectMapper mockObjectMapper = mock(ObjectMapper.class);
testNeeds = new Need[] {
- new Need("one", "Atlantis", 0, 100, Need.GoalType.MONETARY, false),
- new Need("two", "Atlantis", 1, 100, Need.GoalType.MONETARY, false),
- new Need("three", "Atlantis", 2, 100, Need.GoalType.MONETARY, false)
+ new Need("one", "", "Atlantis", 0, 100, Need.GoalType.MONETARY, false, ""),
+ new Need("two", "", "Atlantis", 1, 100, Need.GoalType.MONETARY, false, ""),
+ new Need("three", "", "Atlantis", 2, 100, Need.GoalType.MONETARY, false, "")
};
// When the object mapper is supposed to read from the file
// the mock object mapper will return the hero array above
@@ -54,7 +54,7 @@ public class CupboardFileDAOTest {
@Test
public void createNeedTest() throws IOException {
- Need newNeed = new Need("sea urchin hats", "Atlantis", 100, GoalType.PHYSICAL, false);
+ Need newNeed = new Need("sea urchin hats", "", "Atlantis", 100, GoalType.PHYSICAL, false, "");
Need actualNeed = cupboardFileDao.addNeed(newNeed);
@@ -90,7 +90,7 @@ public class CupboardFileDAOTest {
Need unupdatedNeed = needs[needs.length - 1];
assertNotNull(unupdatedNeed);
- Need updatedNeed = new Need("sequin sea urchin hats", "Atlantis", 100, GoalType.PHYSICAL, false);
+ Need updatedNeed = new Need("sequin sea urchin hats", "", "Atlantis", 100, GoalType.PHYSICAL, false, "");
Need actualNeed = cupboardFileDao.updateNeed(updatedNeed);
assertEquals(actualNeed, updatedNeed);
@@ -103,7 +103,7 @@ public class CupboardFileDAOTest {
Need unupdatedNeed = needs[needs.length - 1];
assertNotNull(unupdatedNeed);
- Need updatedNeed = new Need("sequin sea urchin hats", "Atlantis", 5, 100, GoalType.PHYSICAL, false);
+ Need updatedNeed = new Need("sequin sea urchin hats", "", "Atlantis", 5, 100, GoalType.PHYSICAL, false, "");
Need actualNeed = cupboardFileDao.updateNeed(updatedNeed);
assertNull(actualNeed);
diff --git a/ufund-api/src/test/java/com/ufund/api/ufundapi/service/CupboardServiceTest.java b/ufund-api/src/test/java/com/ufund/api/ufundapi/service/CupboardServiceTest.java
index f3cbc23..2a3c8ee 100644
--- a/ufund-api/src/test/java/com/ufund/api/ufundapi/service/CupboardServiceTest.java
+++ b/ufund-api/src/test/java/com/ufund/api/ufundapi/service/CupboardServiceTest.java
@@ -40,14 +40,16 @@ public class CupboardServiceTest {
double maxGoal = 100;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
// When the same id is passed in, our mock User DAO will return the User object
when(mockCupboardDAO.addNeed(any())).thenReturn(need);
when(mockCupboardDAO.getNeeds()).thenReturn(new Need[0]);
// Invoke
- Need response = cupboardService.createNeed(name, location, maxGoal, type, urgent);
+ Need response = cupboardService.createNeed(name, location, image, maxGoal, type, urgent, description);
// Analyze
assertNotNull(response);
@@ -62,7 +64,9 @@ public class CupboardServiceTest {
double maxGoal = -100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
// When the same id is passed in, our mock User DAO will return the User object
when(mockCupboardDAO.addNeed(any())).thenReturn(need);
@@ -73,7 +77,7 @@ public class CupboardServiceTest {
// Analyze
assertThrows(IllegalArgumentException.class, () ->
- cupboardService.createNeed(name, location, maxGoal, type, urgent));
+ cupboardService.createNeed(name, location, image, maxGoal, type, urgent, description));
}
@Test
@@ -84,7 +88,9 @@ public class CupboardServiceTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
Need[] needs = { need };
// When the same id is passed in, our mock User DAO will return the User object
@@ -96,7 +102,7 @@ public class CupboardServiceTest {
// Analyze
assertThrows(DuplicateKeyException.class, () ->
- cupboardService.createNeed(name, location, maxGoal, type, urgent));
+ cupboardService.createNeed(name, location, image, maxGoal, type, urgent, description));
}
@Test
@@ -107,7 +113,9 @@ public class CupboardServiceTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
Need[] needs = { need };
// When the same id is passed in, our mock User DAO will return the User object
@@ -129,7 +137,9 @@ public class CupboardServiceTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
Need[] needs = { need };
// When the same id is passed in, our mock User DAO will return the User object
@@ -150,7 +160,9 @@ public class CupboardServiceTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- var need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
// When the same id is passed in, our mock User DAO will return the User object
when(mockCupboardDAO.getNeed(0)).thenReturn(need);
@@ -170,8 +182,10 @@ public class CupboardServiceTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- Need need = new Need(name, location, maxGoal, type, urgent);
- Need newNeed = new Need("Octopus", location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
+ Need newNeed = new Need("Octopus", image, location, maxGoal, type, urgent, description);
// When the same id is passed in, our mock User DAO will return the User object
when(mockCupboardDAO.updateNeed(any())).thenReturn(newNeed);
@@ -191,7 +205,9 @@ public class CupboardServiceTest {
double maxGoal = 100.0;
GoalType type = Need.GoalType.MONETARY;
boolean urgent = false;
- Need need = new Need(name, location, maxGoal, type, urgent);
+ String image = "";
+ String description = "";
+ var need = new Need(name, image, location, maxGoal, type, urgent, description);
// When the same id is passed in, our mock User DAO will return the User object
when(mockCupboardDAO.deleteNeed(0)).thenReturn(true);