From b544f2617843af29875af81923d3bec539aca704 Mon Sep 17 00:00:00 2001 From: Gunther6070 Date: Tue, 1 Apr 2025 07:45:25 -0400 Subject: Added updated acceptance test plan --- etc/Acceptance Test Plan.xlsx | Bin 30698 -> 71297 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/etc/Acceptance Test Plan.xlsx b/etc/Acceptance Test Plan.xlsx index dd55e20..396cc1c 100644 Binary files a/etc/Acceptance Test Plan.xlsx and b/etc/Acceptance Test Plan.xlsx differ -- cgit v1.2.3 From 0b49430e3b0a5cc14521db58af19dafa5384c3c4 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 1 Apr 2025 16:58:12 -0400 Subject: Fix warnings and misaligned prev page button --- .../src/app/components/need-list/need-list.component.html | 2 +- .../src/app/components/need-page/need-page.component.html | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index c0501ba..8d01291 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -65,7 +65,7 @@
- + Page {{currentPage + 1}} of {{totalPages}}
diff --git a/ufund-ui/src/app/components/need-page/need-page.component.html b/ufund-ui/src/app/components/need-page/need-page.component.html index 958dfa6..522b710 100644 --- a/ufund-ui/src/app/components/need-page/need-page.component.html +++ b/ufund-ui/src/app/components/need-page/need-page.component.html @@ -1,14 +1,14 @@
-

{{need?.name}}

- {{need?.type}} GOAL +

{{need.name}}

+ {{need.type}} GOAL - Need image + Need image -

{{need?.description}}

+

{{need.description}}

- - This goal is {{(((need?.current ?? 0)*100) / (need?.maxGoal ?? 0)).toFixed(0)}}% complete! + + This goal is {{(((need.current)*100) / (need.maxGoal)).toFixed(0)}}% complete!
Target Goal: {{need.maxGoal}} -- cgit v1.2.3 From 734d3d380cd70e87474adebedec5e230959bcf81 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 1 Apr 2025 19:44:28 -0400 Subject: Make nav bar buttons only show conditionally --- ufund-ui/src/app/app.component.html | 4 ++-- ufund-ui/src/app/models/User.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ufund-ui/src/app/app.component.html b/ufund-ui/src/app/app.component.html index 959eada..f697695 100644 --- a/ufund-ui/src/app/app.component.html +++ b/ufund-ui/src/app/app.component.html @@ -5,9 +5,9 @@
- Dashboard + Dashboard Cupboard - Basket + Basket diff --git a/ufund-ui/src/app/models/User.ts b/ufund-ui/src/app/models/User.ts index e6848fa..d7d67b5 100644 --- a/ufund-ui/src/app/models/User.ts +++ b/ufund-ui/src/app/models/User.ts @@ -1,6 +1,6 @@ export enum userType { - HELPER, - MANAGER + HELPER = "HELPER", + MANAGER = "MANAGER" } export interface User { -- cgit v1.2.3 From 92fbcbfd6ade1c5fe0cc3c37d6a6914ef1d2a2a4 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 1 Apr 2025 20:04:33 -0400 Subject: Add skip to first / last page in pagination --- ufund-ui/src/app/app.component.ts | 4 +++- .../app/components/need-list/need-list.component.css | 4 ++++ .../app/components/need-list/need-list.component.html | 8 ++++---- .../app/components/need-list/need-list.component.ts | 19 +++++++++++++------ 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ufund-ui/src/app/app.component.ts b/ufund-ui/src/app/app.component.ts index 2f98334..bc0e71a 100644 --- a/ufund-ui/src/app/app.component.ts +++ b/ufund-ui/src/app/app.component.ts @@ -3,7 +3,7 @@ import {BehaviorSubject} from 'rxjs'; import { DOCUMENT } from '@angular/common'; import {AuthService} from './services/auth.service'; import {ToastsService} from './services/toasts.service'; -import {User} from './models/User'; +import {User, userType} from './models/User'; import {ActivatedRoute, Router} from '@angular/router'; @Component({ @@ -48,4 +48,6 @@ export class AppComponent implements OnInit { localStorage.removeItem("credential") location.reload() } + + protected readonly userType = userType; } diff --git a/ufund-ui/src/app/components/need-list/need-list.component.css b/ufund-ui/src/app/components/need-list/need-list.component.css index 5f2e5e1..e17609b 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.css +++ b/ufund-ui/src/app/components/need-list/need-list.component.css @@ -89,6 +89,10 @@ select { background-color: #3a3a3a; border-radius: 5px; cursor: pointer; + height: 130px; + display: flex; + flex-direction: column; + justify-content: space-between; } .clickable:hover { diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index 8d01291..88317dd 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -40,8 +40,6 @@
-
-
{{need.current}}/{{need.maxGoal}} ({{((need.current / need.maxGoal) * 100).toFixed(0)}}%) @@ -65,7 +63,9 @@
- + + Page {{currentPage + 1}} of {{totalPages}} - + +
diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index cd3d9bd..06a612e 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -74,12 +74,22 @@ export class NeedListComponent { decrementPage() { this.currentPage--; - this.updateVisibleNeeds(); + this.updateVisibleNeeds(); } incrementPage() { this.currentPage++; - this.updateVisibleNeeds(); + this.updateVisibleNeeds(); + } + + lastPage() { + this.currentPage = this.totalPages - 1 + this.updateVisibleNeeds() + } + + firstPage() { + this.currentPage = 0 + this.updateVisibleNeeds() } editNeedsPerPage(amount: number) { @@ -135,7 +145,7 @@ export class NeedListComponent { ngOnInit(): void { this.refresh() - + } changeSortMode(form : any) { @@ -269,7 +279,4 @@ export class NeedListComponent { } } } -function not(location: string) { - throw new Error('Function not implemented.'); -} -- cgit v1.2.3 From 77f3cf60bbb9e7b13cc2642fa06b5f40dccdbdb1 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 1 Apr 2025 20:05:06 -0400 Subject: Stub out new admin dashboard --- .../src/app/components/dashboard/dashboard.component.css | 2 +- .../src/app/components/dashboard/dashboard.component.html | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.css b/ufund-ui/src/app/components/dashboard/dashboard.component.css index 78a69ba..185fdc2 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.css +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.css @@ -1,7 +1,7 @@ :host { display: flex; flex-direction: column; - width: 1000px; + width: 800px; align-self: center; gap: 20px } diff --git a/ufund-ui/src/app/components/dashboard/dashboard.component.html b/ufund-ui/src/app/components/dashboard/dashboard.component.html index 6a95ecd..2d7b4c3 100644 --- a/ufund-ui/src/app/components/dashboard/dashboard.component.html +++ b/ufund-ui/src/app/components/dashboard/dashboard.component.html @@ -1,5 +1,10 @@ -

Your Dashboard

- - - +

Admin Dashboard

+ + + +_ Registered users +_ Needs with overflow +_ Needs in peoples baskets +_ Total monetary contributions +_ -- cgit v1.2.3 From 2eb67f9481d858474e77af545e71f68b2cea7041 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 1 Apr 2025 21:17:45 -0400 Subject: Simplify sign up process --- ufund-ui/src/app/components/signup/signup.component.html | 4 +--- ufund-ui/src/app/components/signup/signup.component.ts | 13 ++++--------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/ufund-ui/src/app/components/signup/signup.component.html b/ufund-ui/src/app/components/signup/signup.component.html index bc3aaf0..84f15e4 100644 --- a/ufund-ui/src/app/components/signup/signup.component.html +++ b/ufund-ui/src/app/components/signup/signup.component.html @@ -8,7 +8,7 @@
- + {{passwordStatusText | async}}
@@ -24,8 +24,6 @@
- Account created Proceed to login - {{statusText | async}}
Already have an account? Log in
diff --git a/ufund-ui/src/app/components/signup/signup.component.ts b/ufund-ui/src/app/components/signup/signup.component.ts index a20d828..b040d1a 100644 --- a/ufund-ui/src/app/components/signup/signup.component.ts +++ b/ufund-ui/src/app/components/signup/signup.component.ts @@ -6,7 +6,6 @@ import {ToastsService, ToastType} from '../../services/toasts.service'; class PasswordRequirements { sixLong: {title: string, value: boolean} = {title: 'Is 6 characters or longer' , value: false} - twelveLong: {title: string, value: boolean} = {title: 'Is 12 characters or longer', value: false} lowercase: {title: string, value: boolean} = {title: 'Includes lowercase letter' , value: false} uppercase: {title: string, value: boolean} = {title: 'Includes uppercase letter' , value: false} number: {title: string, value: boolean} = {title: 'Includes number' , value: false} @@ -25,12 +24,10 @@ export class SignupComponent { protected passwordStatusText = new BehaviorSubject("") protected passwordsMatch = new BehaviorSubject(false) protected usernameStatusText = new BehaviorSubject("") - protected showSuccessMessage = new BehaviorSubject(false) protected passwordStrongEnough = new BehaviorSubject(false) protected ableToCreateAccount = new BehaviorSubject(false) protected passwordRequirements: PasswordRequirements = new PasswordRequirements() protected strength = new BehaviorSubject(0) - protected statusText = new BehaviorSubject(""); constructor( protected usersService: UsersService, @@ -45,7 +42,9 @@ export class SignupComponent { } this.usersService.createUser(username, password).then(() => { - this.showSuccessMessage.next(true); + // let action = {label: 'Proceed to login', onAction: () => this.router.navigate(["/login"])} + this.toastService.sendToast(ToastType.INFO, "Account successfully created") + this.router.navigate(["/login"]) }).catch(ex => { this.toastService.sendToast(ToastType.ERROR, "Unable to create account: " + friendlyHttpStatus[ex.status]) console.log(ex) @@ -74,16 +73,12 @@ export class SignupComponent { if (password.match(/[^!-~]/g)) { this.passwordStatusText.next("Invalid characters") - return } if (password.length > 6) { this.passwordRequirements.sixLong.value = true } - if (password.length > 12) { - this.passwordRequirements.twelveLong.value = true - } if (password.match(/[a-z]/g)) { this.passwordRequirements.lowercase.value = true } @@ -108,7 +103,7 @@ export class SignupComponent { } else if (strength == 0) { this.passwordStatusText.next("") } else { - this.passwordStatusText.next("5/6 checks required") + this.passwordStatusText.next("Password must meet requirements") } this.strength.next(strength) -- cgit v1.2.3 From 22df0d963e09520339dfa9c681caeaaec790df8e Mon Sep 17 00:00:00 2001 From: Gunther6070 Date: Wed, 2 Apr 2025 13:33:34 -0400 Subject: Added check to checkout to stop checking out decimal values for physical needs --- .../src/main/java/com/ufund/api/ufundapi/service/CupboardService.java | 3 +++ 1 file changed, 3 insertions(+) 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); -- cgit v1.2.3 From 430bd8d3d13f3716160889d6f18fcb2cd08fcf39 Mon Sep 17 00:00:00 2001 From: sowgro Date: Wed, 2 Apr 2025 13:52:28 -0400 Subject: Make enter on login work --- ufund-ui/src/app/components/login/login.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ufund-ui/src/app/components/login/login.component.html b/ufund-ui/src/app/components/login/login.component.html index c67b903..1017d0f 100644 --- a/ufund-ui/src/app/components/login/login.component.html +++ b/ufund-ui/src/app/components/login/login.component.html @@ -1,7 +1,7 @@

Login

- - + +
New? Create an account -- cgit v1.2.3 From 6ce39f0facc6ae38ff42d1e8efe091f528afc5a0 Mon Sep 17 00:00:00 2001 From: Gunther6070 Date: Wed, 2 Apr 2025 13:55:46 -0400 Subject: Signup logs you in and brings you to home page now. Also modified toasts in funding basket --- .../src/app/components/funding-basket/funding-basket.component.ts | 6 +++--- ufund-ui/src/app/components/signup/signup.component.ts | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts index dcacca1..847baee 100644 --- a/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts +++ b/ufund-ui/src/app/components/funding-basket/funding-basket.component.ts @@ -70,11 +70,11 @@ export class FundingBasketComponent implements OnInit { this.cupboardService.checkoutNeed(need.id, +contribution.value) .pipe(catchError((ex, _) => { if (ex.status == 500) { - this.toastService.sendToast(ToastType.INFO, 'Fields cannot be blank'); + this.toastService.sendToast(ToastType.ERROR, 'Fields cannot be blank'); } else if (ex.status == 400) { - this.toastService.sendToast(ToastType.INFO, 'Goal must be greater than 0'); + this.toastService.sendToast(ToastType.ERROR, ex.error); } else { - this.toastService.sendToast(ToastType.INFO, 'Error on creating need'); + this.toastService.sendToast(ToastType.ERROR, 'Error on creating need'); } return new Observable(); })) diff --git a/ufund-ui/src/app/components/signup/signup.component.ts b/ufund-ui/src/app/components/signup/signup.component.ts index b040d1a..9c37211 100644 --- a/ufund-ui/src/app/components/signup/signup.component.ts +++ b/ufund-ui/src/app/components/signup/signup.component.ts @@ -3,6 +3,7 @@ import {UsersService} from '../../services/users.service'; import {Router} from '@angular/router'; import {BehaviorSubject} from 'rxjs'; import {ToastsService, ToastType} from '../../services/toasts.service'; +import {AuthService} from '../../services/auth.service'; class PasswordRequirements { sixLong: {title: string, value: boolean} = {title: 'Is 6 characters or longer' , value: false} @@ -32,7 +33,8 @@ export class SignupComponent { constructor( protected usersService: UsersService, protected router: Router, - protected toastService: ToastsService + protected toastService: ToastsService, + protected authService: AuthService ) {} signup(username: string | null, password: string | null) { @@ -44,7 +46,8 @@ export class SignupComponent { this.usersService.createUser(username, password).then(() => { // let action = {label: 'Proceed to login', onAction: () => this.router.navigate(["/login"])} this.toastService.sendToast(ToastType.INFO, "Account successfully created") - this.router.navigate(["/login"]) + this.authService.login(username, password) + this.router.navigate(["/"]) }).catch(ex => { this.toastService.sendToast(ToastType.ERROR, "Unable to create account: " + friendlyHttpStatus[ex.status]) console.log(ex) -- cgit v1.2.3 From 4d382ccf9de889e4b339dd13220c3f761497e419 Mon Sep 17 00:00:00 2001 From: Gunther6070 Date: Wed, 2 Apr 2025 16:08:52 -0400 Subject: Added dollar signs and other small additions to needs --- ufund-ui/src/app/components/cupboard/cupboard.component.ts | 8 ++------ ufund-ui/src/app/components/need-list/need-list.component.ts | 9 ++++++++- ufund-ui/src/app/models/Need.ts | 4 ++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ufund-ui/src/app/components/cupboard/cupboard.component.ts b/ufund-ui/src/app/components/cupboard/cupboard.component.ts index 2230cd3..a4706b3 100644 --- a/ufund-ui/src/app/components/cupboard/cupboard.component.ts +++ b/ufund-ui/src/app/components/cupboard/cupboard.component.ts @@ -1,6 +1,6 @@ import {Component, OnInit, ViewChild} from '@angular/core'; import { CupboardService } from '../../services/cupboard.service'; -import { Need, GoalType } from '../../models/Need'; +import { Need } from '../../models/Need'; import { userType } from '../../models/User'; import { catchError, of } from 'rxjs'; import { NeedListComponent } from '../need-list/need-list.component'; @@ -90,7 +90,7 @@ export class CupboardComponent implements OnInit { id: 0, maxGoal: form.maxGoal, type: form.type, - urgent: form.urgent ? true : false, + urgent: !!form.urgent, filterAttributes: [], current: 0, description: form.description @@ -120,8 +120,4 @@ export class CupboardComponent implements OnInit { ); } - - destroy() { - - } } diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index 06a612e..2ec850e 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -1,5 +1,5 @@ import {Component, EventEmitter, Output} from '@angular/core'; -import {Need} from '../../models/Need'; +import {GoalType, Need} from '../../models/Need'; import {CupboardService} from '../../services/cupboard.service'; import {UsersService} from '../../services/users.service'; import {userType} from '../../models/User'; @@ -72,6 +72,10 @@ export class NeedListComponent { itemsPerPage: number = 5; totalPages: number = Math.ceil(this.needs.length / this.itemsPerPage); + getPrefix(need: Need) { + return (need.type === GoalType.MONETARY) ? "$" : ""; + } + decrementPage() { this.currentPage--; this.updateVisibleNeeds(); @@ -229,6 +233,7 @@ export class NeedListComponent { if (currentUser) { if (!currentUser.basket.includes(need.id)) { currentUser.basket.push(need.id); + this.toastService.sendToast(ToastType.INFO, "Need added to your basket!") this.usersService.updateUser(currentUser) .pipe(catchError((err, _) => { console.error(err); @@ -278,5 +283,7 @@ export class NeedListComponent { button.style.visibility = 'hidden'; } } + + protected readonly GoalType = GoalType; } diff --git a/ufund-ui/src/app/models/Need.ts b/ufund-ui/src/app/models/Need.ts index 6cf7e76..588e745 100644 --- a/ufund-ui/src/app/models/Need.ts +++ b/ufund-ui/src/app/models/Need.ts @@ -12,6 +12,6 @@ export interface Need { } export enum GoalType { - MONETARY, - PHYSICAL + MONETARY = 'MONETARY', + PHYSICAL = 'PHYSICAL' } -- cgit v1.2.3 From bc23c624a760b33bb67b3c0df5fd3d8f39f36e77 Mon Sep 17 00:00:00 2001 From: Gunther6070 Date: Wed, 2 Apr 2025 16:09:24 -0400 Subject: Added dollar signs and other small additions to needs --- ufund-ui/src/app/components/need-list/need-list.component.html | 2 +- ufund-ui/src/app/components/need-page/need-page.component.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ufund-ui/src/app/components/need-list/need-list.component.html b/ufund-ui/src/app/components/need-list/need-list.component.html index 88317dd..593aebf 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.html +++ b/ufund-ui/src/app/components/need-list/need-list.component.html @@ -42,7 +42,7 @@
- {{need.current}}/{{need.maxGoal}} ({{((need.current / need.maxGoal) * 100).toFixed(0)}}%) + {{getPrefix(need)}}{{need.current}}/{{need.maxGoal}} ({{((need.current / need.maxGoal) * 100).toFixed(0)}}%)
diff --git a/ufund-ui/src/app/components/need-page/need-page.component.html b/ufund-ui/src/app/components/need-page/need-page.component.html index 522b710..3d362f5 100644 --- a/ufund-ui/src/app/components/need-page/need-page.component.html +++ b/ufund-ui/src/app/components/need-page/need-page.component.html @@ -11,7 +11,7 @@ This goal is {{(((need.current)*100) / (need.maxGoal)).toFixed(0)}}% complete!
- Target Goal: {{need.maxGoal}} + Target Goal: {{(need.type === GoalType.MONETARY) ? "$" : ""}}{{need.maxGoal}} Amount Currently Collected: {{need.current}} -- cgit v1.2.3 From c561e9a5b36bafbb5e6f277b04f112941c2231a5 Mon Sep 17 00:00:00 2001 From: Gunther6070 Date: Wed, 2 Apr 2025 16:56:27 -0400 Subject: Implemented new endpoint to get total number of users --- .../api/ufundapi/controller/UserController.java | 26 ++++++++++++++++++++++ .../ufund/api/ufundapi/persistence/UserDAO.java | 10 +++++++++ .../api/ufundapi/persistence/UserFileDAO.java | 7 ++++++ .../ufund/api/ufundapi/service/UserService.java | 10 +++++++++ 4 files changed, 53 insertions(+) diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/UserController.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/UserController.java index a34e891..653a925 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/UserController.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/UserController.java @@ -94,6 +94,32 @@ public class UserController { } + /** + * Responds to the GET request with the total number of users + * + * @param key The authentication key of the user + * @return ResponseEntity with amount and HTTP status of OK
+ * ResponseEntity with HTTP status of UNAUTHORIZED if user is not aa manager
+ * ResponseEntity with HTTP status of INTERNAL_SERVER_ERROR otherwise + */ + @GetMapping("/userCount") + public ResponseEntity getUserCount(@RequestHeader("jelly-api-key") String key) { + LOG.log(Level.INFO, "GET /userAmount"); + + try { + authService.keyHasAccessToCupboard(key); + int count = userService.getUserCount(); + return new ResponseEntity<>(count, HttpStatus.OK); + } catch (IllegalAccessException ex) { + LOG.log(Level.WARNING, ex.getLocalizedMessage()); + return new ResponseEntity<>(ex.getMessage(), HttpStatus.UNAUTHORIZED); + } catch (IOException ex) { + LOG.log(Level.SEVERE, ex.getLocalizedMessage()); + return new ResponseEntity<>(ex.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); + } + + } + /** * Updates a User with the provided one * diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserDAO.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserDAO.java index 29d46cf..27ba0b9 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserDAO.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserDAO.java @@ -33,6 +33,16 @@ public interface UserDAO { */ User getUser(String username) throws IOException; + /** + * Retrieves the total count of users + * + * @return a {@link int amount} number of users + *
+ * + * @throws IOException if an issue with underlying storage + */ + int getUserCount() throws IOException; + /** * Creates and saves a {@linkplain User user} * diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java index ec94da8..7f1fadd 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java @@ -57,6 +57,13 @@ public class UserFileDAO implements UserDAO { } } + @Override + public int getUserCount() { + synchronized (users) { + return users.size(); + } + } + @Override public User getUser(String username) { synchronized (users) { 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 @@ -55,6 +55,16 @@ public class UserService { return userDAO.getUser(username); } + /** + * 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 * -- cgit v1.2.3 From f8641c164ddc3a0ae4e8e81aa8f5595ce751b17c Mon Sep 17 00:00:00 2001 From: Gunther6070 Date: Wed, 2 Apr 2025 16:57:07 -0400 Subject: Implemented new endpoint to get total number of users --- .../src/main/java/com/ufund/api/ufundapi/controller/UserController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/UserController.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/UserController.java index 653a925..c6e622c 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/UserController.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/controller/UserController.java @@ -102,7 +102,7 @@ public class UserController { * ResponseEntity with HTTP status of UNAUTHORIZED if user is not aa manager
* ResponseEntity with HTTP status of INTERNAL_SERVER_ERROR otherwise */ - @GetMapping("/userCount") + @GetMapping("/count") public ResponseEntity getUserCount(@RequestHeader("jelly-api-key") String key) { LOG.log(Level.INFO, "GET /userAmount"); -- cgit v1.2.3 From 5be753d9826629bdcaff5a7e48ba6b81e8e1e7cf Mon Sep 17 00:00:00 2001 From: benal01 Date: Wed, 2 Apr 2025 22:25:11 -0400 Subject: placeholder for unset need images --- ufund-ui/public/placeholder.png | Bin 0 -> 605690 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 ufund-ui/public/placeholder.png diff --git a/ufund-ui/public/placeholder.png b/ufund-ui/public/placeholder.png new file mode 100644 index 0000000..5b86fb7 Binary files /dev/null and b/ufund-ui/public/placeholder.png differ -- cgit v1.2.3 From 010d2ed677e1fca33cee0963a897492f5902cb89 Mon Sep 17 00:00:00 2001 From: benal01 Date: Wed, 2 Apr 2025 22:25:30 -0400 Subject: need image support in need page --- .../components/need-page/need-page.component.css | 11 +++++++ .../components/need-page/need-page.component.html | 35 ++++++++++++---------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/ufund-ui/src/app/components/need-page/need-page.component.css b/ufund-ui/src/app/components/need-page/need-page.component.css index 844410f..e634c8f 100644 --- a/ufund-ui/src/app/components/need-page/need-page.component.css +++ b/ufund-ui/src/app/components/need-page/need-page.component.css @@ -31,6 +31,7 @@ .left { display: flex; flex-direction: column; + width : 50%; } .right { @@ -40,6 +41,16 @@ } } +.need-image { + width: 80%; + height: auto; + aspect-ratio: 16/9; + object-fit: cover; + border-radius: 10px; + box-shadow: rgb(0, 40, 70) 0 0 50px; + +} + .urgent { font-size: 11pt; background-color: rgba(255, 165, 0, 0.27); diff --git a/ufund-ui/src/app/components/need-page/need-page.component.html b/ufund-ui/src/app/components/need-page/need-page.component.html index 3d362f5..210e444 100644 --- a/ufund-ui/src/app/components/need-page/need-page.component.html +++ b/ufund-ui/src/app/components/need-page/need-page.component.html @@ -1,9 +1,6 @@

{{need.name}}

{{need.type}} GOAL - - Need image -

{{need.description}}

@@ -11,25 +8,33 @@ This goal is {{(((need.current)*100) / (need.maxGoal)).toFixed(0)}}% complete!
+
+
Target Goal: {{(need.type === GoalType.MONETARY) ? "$" : ""}}{{need.maxGoal}} Amount Currently Collected: {{need.current}} Location: {{need.location}} - Urgency: - Not urgent - URGENT - - -
- Tags: -
    -
  • -

    {{tag}}

    -
  • -
+ Urgency: + Not urgent + URGENT + + +
+ Tags: +
    +
  • +

    {{tag}}

    +
  • +
+
+
+
+ Need image +
+
- Need image + Need image
-- cgit v1.2.3