From 50475408d8f500f5e023f9f889e9832a3d34ba98 Mon Sep 17 00:00:00 2001 From: cathrkri Date: Fri, 17 Apr 2026 10:27:36 +0200 Subject: [PATCH] feat: Sequence diagrams updated --- .../App_startup_and_api_sync.puml | 46 +++++++++++ .../Authentication_backend_flow.puml | 77 +++++++++++++++++ helpmehelpapplication/Frontpage_load.puml | 38 +++++++++ .../Full_organisation_enrichment_scrape.puml | 39 +++++++++ .../Organization_message.puml | 31 ------- .../Organization_onboard.puml | 46 ----------- .../Organization_update_profile.puml | 26 ------ .../Search_and_browse_organisation.puml | 82 +++++++++++++++++++ helpmehelpapplication/User_authenticator.puml | 36 -------- helpmehelpapplication/User_browser.puml | 56 ------------- helpmehelpapplication/User_donate.puml | 41 ---------- helpmehelpapplication/User_donation.puml | 40 +++++++++ .../View_organisation_details.puml | 29 +++++++ 13 files changed, 351 insertions(+), 236 deletions(-) create mode 100644 helpmehelpapplication/App_startup_and_api_sync.puml create mode 100644 helpmehelpapplication/Authentication_backend_flow.puml create mode 100644 helpmehelpapplication/Frontpage_load.puml create mode 100644 helpmehelpapplication/Full_organisation_enrichment_scrape.puml delete mode 100644 helpmehelpapplication/Organization_message.puml delete mode 100644 helpmehelpapplication/Organization_onboard.puml delete mode 100644 helpmehelpapplication/Organization_update_profile.puml create mode 100644 helpmehelpapplication/Search_and_browse_organisation.puml delete mode 100644 helpmehelpapplication/User_authenticator.puml delete mode 100644 helpmehelpapplication/User_browser.puml delete mode 100644 helpmehelpapplication/User_donate.puml create mode 100644 helpmehelpapplication/User_donation.puml create mode 100644 helpmehelpapplication/View_organisation_details.puml diff --git a/helpmehelpapplication/App_startup_and_api_sync.puml b/helpmehelpapplication/App_startup_and_api_sync.puml new file mode 100644 index 00000000..fc1956dd --- /dev/null +++ b/helpmehelpapplication/App_startup_and_api_sync.puml @@ -0,0 +1,46 @@ +@startuml +!theme plain +skinparam backgroundColor white + +title Application startup and organisation data sync from API + +participant "HmHApplication" as App +participant "DatabaseSetup" as Setup +participant "DatabaseConnection" as DBConn +participant "APICharityScraper" as API +participant "APIToDatabaseService" as Sync +database "MySQL DB" as DB +collections "CharityRegistry" as Registry + +App -> Setup : testConnection() +Setup -> DBConn : getMySqlConnection() +DBConn --> Setup : connection +Setup --> App : OK + +App -> Setup : createTables() +Setup -> DB : CREATE TABLE IF NOT EXISTS ... +DB --> Setup : tables ready +Setup --> App : OK + +App -> API : checkConnection() +API --> App : true +App -> API : getJSONData() +API --> App : JSON payload +App -> API : parseJSON(json) +API --> App : CharityRegistry + +App -> Sync : addAPIDataToTable(Registry.getAllCharities()) +activate Sync +Sync -> DBConn : getMySqlConnection() +DBConn --> Sync : SQL connection +loop For each charity from API + Sync -> DB : INSERT/UPDATE Charities + Sync -> DB : INSERT/UPDATE CharityVanity +end +Sync -> DB : CREATE TEMP TABLE temp_api_charities +Sync -> DB : INSERT current org numbers into temp table +Sync -> DB : DELETE stale charities not referenced elsewhere +DB --> Sync : commit complete +Sync --> App : Sync finished +Deactivate Sync +@enduml diff --git a/helpmehelpapplication/Authentication_backend_flow.puml b/helpmehelpapplication/Authentication_backend_flow.puml new file mode 100644 index 00000000..6668108d --- /dev/null +++ b/helpmehelpapplication/Authentication_backend_flow.puml @@ -0,0 +1,77 @@ +@startuml +!theme plain +skinparam backgroundColor white + +title User registration, login and logout backend flow + +actor User +participant "UI / Controller" as UI +participant "AuthenticationService" as Auth +participant "UserSelect" as UserSelect +participant "UserDAO" as UserDAO +database "MySQL DB" as DB + +== Registration == +User -> UI : Submit displayName, username, email, password +UI -> Auth : register(displayName, username, email, password) +activate Auth +Auth -> UserSelect : isUsernameTaken(username) +activate UserSelect +UserSelect -> DB : SELECT UUID_User FROM User WHERE user_name = username +DB --> UserSelect : username exists / not found +UserSelect --> Auth : true / false +Deactivate UserSelect + +alt Username already taken + Auth --> UI : false + UI --> User : Show registration failed +else Username available + Auth -> UserDAO : registerUser(new User) + activate UserDAO + UserDAO -> DB : INSERT INTO User + UserDAO -> DB : INSERT INTO Settings + DB --> UserDAO : insert result + UserDAO --> Auth : success / failure + deactivate UserDAO + + alt Registration successful + Auth -> Auth : currentUser = newUser + Auth --> UI : true + UI --> User : Show registration successful + else Registration failed + Auth --> UI : false + UI --> User : Show registration failed + end +end +Deactivate Auth + +== Login == +User -> UI : Submit username and password +UI -> Auth : login(username, password) +activate Auth +Auth -> UserSelect : getUserFromDBUsernameAndPassword(username, password) +activate UserSelect +UserSelect -> DB : SELECT User + Settings + Messages +DB --> UserSelect : matching user rows +UserSelect --> Auth : User / null +Deactivate UserSelect + +alt Matching user found + Auth -> Auth : currentUser = user + Auth --> UI : true + UI --> User : Show logged-in state +else No match + Auth --> UI : false + UI --> User : Show login failed +end +Deactivate Auth + +== Logout == +User -> UI : Click logout +UI -> Auth : logout() +activate Auth +Auth -> Auth : currentUser = null +Auth --> UI : logged out +UI --> User : Return to logged-out state +Deactivate Auth +@enduml diff --git a/helpmehelpapplication/Frontpage_load.puml b/helpmehelpapplication/Frontpage_load.puml new file mode 100644 index 00000000..0175096b --- /dev/null +++ b/helpmehelpapplication/Frontpage_load.puml @@ -0,0 +1,38 @@ +@startuml +!theme plain +skinparam backgroundColor white + +title User opens front page and the app loads featured organisations + +actor User +participant "FrontpageController" as Frontpage +participant "DatabaseConnection" as DBConn +participant "CharitySelect" as CharitySelect +participant "DonationSelect" as DonationSelect +database "MySQL DB" as DB + +User -> Frontpage : Open application / front page +activate Frontpage +Frontpage -> DBConn : create connection +DBConn --> Frontpage : connection helper + +Frontpage -> CharitySelect : getCharitiesFromDB() +activate CharitySelect +CharitySelect -> DB : SELECT charities + charity vanity + categories + feedback +DB --> CharitySelect : CharityRegistry +CharitySelect --> Frontpage : CharityRegistry +Deactivate CharitySelect + +Frontpage -> DonationSelect : getDonationFromDB() +activate DonationSelect +DonationSelect -> DB : SELECT donations + charity + user +DB --> DonationSelect : DonationRegistry +DonationSelect --> Frontpage : DonationRegistry +Deactivate DonationSelect + +Frontpage -> Frontpage : displayCharities(allCharities) +Frontpage -> Frontpage : choose random featured charity +Frontpage -> Frontpage : calculate totals and pre-approved percentage +Frontpage --> User : Show cards, featured charity and statistics +Deactivate Frontpage +@enduml diff --git a/helpmehelpapplication/Full_organisation_enrichment_scrape.puml b/helpmehelpapplication/Full_organisation_enrichment_scrape.puml new file mode 100644 index 00000000..087c774d --- /dev/null +++ b/helpmehelpapplication/Full_organisation_enrichment_scrape.puml @@ -0,0 +1,39 @@ +@startuml +!theme plain +skinparam backgroundColor white + +title Full organisation enrichment scrape + +actor "System / Developer" as Operator +participant "FullCharityScrape" as FullScrape +participant "APICharityScraper" as API +participant "URLCharityScraper" as URLScraper +participant "LogoDownloader" as Logo +collections "CharityRegistry" as Registry +collections "Charity" as Charity + +Operator -> FullScrape : getAPIAndURLCharityData() +activate FullScrape +FullScrape -> API : checkConnection() +API --> FullScrape : true +FullScrape -> API : getJSONData() +API --> FullScrape : JSON payload +FullScrape -> API : parseJSON(json) +API --> FullScrape : CharityRegistry + +loop For each charity in registry + FullScrape -> URLScraper : new URLCharityScraper(charity.getURL()) + FullScrape -> URLScraper : scrapeCharityPage() + URLScraper --> FullScrape : description, categories, logoURL, keyValues + FullScrape -> Logo : downloadImageAsBlob(logoURL) + Logo --> FullScrape : logo blob + FullScrape -> Charity : setDescription(...) + FullScrape -> Charity : setCategory(...) + FullScrape -> Charity : setLogoURL(...) + FullScrape -> Charity : setKeyValues(...) + FullScrape -> Charity : setLogoBlob(...) +end + +FullScrape --> Operator : Fully enriched CharityRegistry +Deactivate FullScrape +@enduml diff --git a/helpmehelpapplication/Organization_message.puml b/helpmehelpapplication/Organization_message.puml deleted file mode 100644 index 81ef5b9a..00000000 --- a/helpmehelpapplication/Organization_message.puml +++ /dev/null @@ -1,31 +0,0 @@ - -'https://plantuml.com/sequence-diagram - -@startuml -title Messaging between Organisation and User - -actor Organisation as Org -actor User -participant "Organization Portal (UI)" as OrgUI -participant "User App (UI)" as UserUI -participant "Messaging Service" as MsgSvc -database "Messages DB" as MsgDB -participant "Notification Service" as Notify - -Org -> OrgUI: Write message to user -OrgUI -> MsgSvc: sendMessage(orgId, userId, content) -MsgSvc -> MsgDB: store message -MsgDB --> MsgSvc: stored -MsgSvc -> Notify: notifyUser(userId, "New message") -Notify --> MsgSvc: queued -MsgSvc --> OrgUI: sent OK -OrgUI --> Org: Message sent - -User -> UserUI: Open Inbox -UserUI -> MsgSvc: getInbox(userId) -MsgSvc -> MsgDB: fetch messages for userId -MsgDB --> MsgSvc: messages -MsgSvc --> UserUI: messages -UserUI --> User: Display inbox - -@enduml \ No newline at end of file diff --git a/helpmehelpapplication/Organization_onboard.puml b/helpmehelpapplication/Organization_onboard.puml deleted file mode 100644 index fe48d6f3..00000000 --- a/helpmehelpapplication/Organization_onboard.puml +++ /dev/null @@ -1,46 +0,0 @@ - -'https://plantuml.com/sequence-diagram - -@startuml -title Organisation onboarding - -actor Organisation as Org -participant "Organization Portal (UI)" as UI -participant "Authentication Service" as Auth -participant "Email Service" as Mail -participant "Organisation Service" as OrgSvc -database "Organisation DB" as OrgDB -participant "Payment Provider" as Pay - -Org -> UI: Open Organisation Portal Dashboard -UI --> Org: Show portal dashboard - -Org -> UI: Register organisation account -UI -> Auth: register(orgEmail, password) -Auth --> UI: accountCreated + verificationToken - -Auth -> Mail: sendVerificationEmail(orgEmail, token) -Mail --> Auth: sent - -Org -> UI: Click verification link (token) -UI -> Auth: verifyEmail(token) -Auth --> UI: verified OK - -Org -> UI: Create organisation profile (name, desc, category, media) -UI -> OrgSvc: createProfile(profileData) -OrgSvc -> OrgDB: insert profile -OrgDB --> OrgSvc: created -OrgSvc --> UI: profileCreated -UI --> Org: Profile created - -Org -> UI: Set up payout account -UI -> Pay: createConnectedAccount(orgData) -Pay --> UI: connectedAccountId + status - -UI -> OrgSvc: savePayoutAccount(orgId, connectedAccountId) -OrgSvc -> OrgDB: update payout info -OrgDB --> OrgSvc: saved -OrgSvc --> UI: payoutSetupSaved -UI --> Org: Payout setup complete - -@enduml diff --git a/helpmehelpapplication/Organization_update_profile.puml b/helpmehelpapplication/Organization_update_profile.puml deleted file mode 100644 index e6ef6f06..00000000 --- a/helpmehelpapplication/Organization_update_profile.puml +++ /dev/null @@ -1,26 +0,0 @@ - -'https://plantuml.com/sequence-diagram - -@startuml -title Organisation updates profile - -actor Organisation as Org -participant "Organization Portal (UI)" as UI -participant "Organisation Service" as OrgSvc -database "Organisation DB" as OrgDB - -Org -> UI: Open My Organisation Profile -UI -> OrgSvc: getProfile -OrgSvc -> OrgDB: load profile -OrgDB --> OrgSvc: profile data -OrgSvc --> UI: profile data -UI --> Org: Show profile - -Org -> UI: Edit profile fields + upload media -UI -> OrgSvc: updateProfile -OrgSvc -> OrgDB: update profile -OrgDB --> OrgSvc: updated -OrgSvc --> UI: update OK -UI --> Org: Show updated profile - -@enduml diff --git a/helpmehelpapplication/Search_and_browse_organisation.puml b/helpmehelpapplication/Search_and_browse_organisation.puml new file mode 100644 index 00000000..6d297588 --- /dev/null +++ b/helpmehelpapplication/Search_and_browse_organisation.puml @@ -0,0 +1,82 @@ +@startuml +!theme plain +skinparam backgroundColor white + +title User searches and browses organisations + +actor User +participant "FrontpageController / CharityPageController / DonationPageController" as SourceUI +participant "LoaderScene" as Loader +participant "AvailableOrganizationController" as Available +participant "DatabaseConnection" as DBConn +participant "CharitySelect" as CharitySelect +database "MySQL DB" as DB + +User -> SourceUI : Enter search text and press search +SourceUI -> Loader : LoadScene("availableOrganization", query) +Loader -> Available : initialize() +activate Available +Available -> DBConn : create connection +DBConn --> Available : connection helper +Available -> CharitySelect : getCharitiesFromDB() +activate CharitySelect +CharitySelect -> DB : SELECT charities + charity vanity + categories + feedback +DB --> CharitySelect : CharityRegistry +CharitySelect --> Available : CharityRegistry +Deactivate CharitySelect + +Available -> Available : setInitialSearch(query) +Available -> Available : filterCharities(query) +Available -> Available : displayCharities(matches) +Available --> User : Show matching organisation cards + +loop While user edits the search field + User -> Available : Update search text + Available -> Available : filterCharities(newValue) + Available -> Available : displayCharities(filtered list) + Available --> User : Refresh result list +end + +deactivate Available +@enduml +@startuml +!theme plain +skinparam backgroundColor white + +title User searches and browses organisations + +actor User +participant "FrontpageController / CharityPageController / DonationPageController" as SourceUI +participant "LoaderScene" as Loader +participant "AvailableOrganizationController" as Available +participant "DatabaseConnection" as DBConn +participant "CharitySelect" as CharitySelect +database "MySQL DB" as DB + +User -> SourceUI : Enter search text and press search +SourceUI -> Loader : LoadScene("availableOrganization", query) +Loader -> Available : initialize() +activate Available +Available -> DBConn : create connection +DBConn --> Available : connection helper +Available -> CharitySelect : getCharitiesFromDB() +activate CharitySelect +CharitySelect -> DB : SELECT charities + charity vanity + categories + feedback +DB --> CharitySelect : CharityRegistry +CharitySelect --> Available : CharityRegistry +Deactivate CharitySelect + +Available -> Available : setInitialSearch(query) +Available -> Available : filterCharities(query) +Available -> Available : displayCharities(matches) +Available --> User : Show matching organisation cards + +loop While user edits the search field + User -> Available : Update search text + Available -> Available : filterCharities(newValue) + Available -> Available : displayCharities(filtered list) + Available --> User : Refresh result list +end + +deactivate Available +@enduml diff --git a/helpmehelpapplication/User_authenticator.puml b/helpmehelpapplication/User_authenticator.puml deleted file mode 100644 index 403814fd..00000000 --- a/helpmehelpapplication/User_authenticator.puml +++ /dev/null @@ -1,36 +0,0 @@ - -'https://plantuml.com/sequence-diagram - -@startuml -title User authentication for for signin and Login - -actor User -participant "Desktop App (UI)" as UI -participant "Authenticator Service" as Auth -database "User DB" as UDB - -User -> UI: Open Dashboard -UI --> User: Show dashboard - -User -> UI: Click Login -UI --> User: Show Welcome/Login page - -User -> UI: Go to Sign In -UI --> User: Show Sign In form - -User -> UI: Submit credentials -UI -> Auth: signIn(email, password) -Auth -> UDB: validate credentials -UDB --> Auth: valid -Auth --> UI: session/token -UI --> User: Logged in (Dashboard updated) - -User -> UI: Click "My Profile" (from Dashboard) -UI --> User: Show Profile - -User -> UI: Click Logout -UI -> Auth: logout(session) -Auth --> UI: session terminated -UI --> User: Redirect to Dashboard - -@enduml diff --git a/helpmehelpapplication/User_browser.puml b/helpmehelpapplication/User_browser.puml deleted file mode 100644 index d279b7e8..00000000 --- a/helpmehelpapplication/User_browser.puml +++ /dev/null @@ -1,56 +0,0 @@ - -'https://plantuml.com/sequence-diagram - -@startuml -title User explores organisations - -actor User -participant "Desktop App (UI)" as UI -participant "Organisation Service" as OrgSvc -database "Organisation DB" as OrgDB - -User -> UI: Open Dashboard -UI --> User: Show dashboard - -User -> UI: Click "Browse Organisations" -UI -> OrgSvc: getFeaturedOrgs() -OrgSvc -> OrgDB: query featured orgs -OrgDB --> OrgSvc: org list -OrgSvc --> UI: org list -UI --> User: Show organisations list - -alt User chooses Category - User -> UI: Select category - UI -> OrgSvc: getOrgsByCategory(category) - OrgSvc -> OrgDB: query orgs by category - OrgDB --> OrgSvc: results - OrgSvc --> UI: results - UI --> User: Show filtered list -end - -alt User uses Filter/Sort - User -> UI: Set filters/sort - UI -> OrgSvc: getOrgsFiltered(filters, sort) - OrgSvc -> OrgDB: query with filters/sort - OrgDB --> OrgSvc: results - OrgSvc --> UI: results - UI --> User: Show filtered list -end - -alt User searches from Dashboard or list - User -> UI: Search organisations (query) - UI -> OrgSvc: searchOrgs(query) - OrgSvc -> OrgDB: fulltext/search query - OrgDB --> OrgSvc: results - OrgSvc --> UI: results - UI --> User: Show search results -end - -User -> UI: Open organisation page -UI -> OrgSvc: getOrganisationDetails(orgId) -OrgSvc -> OrgDB: load org details -OrgDB --> OrgSvc: org details -OrgSvc --> UI: org details -UI --> User: Show organisation page - -@enduml \ No newline at end of file diff --git a/helpmehelpapplication/User_donate.puml b/helpmehelpapplication/User_donate.puml deleted file mode 100644 index f856d182..00000000 --- a/helpmehelpapplication/User_donate.puml +++ /dev/null @@ -1,41 +0,0 @@ - -'https://plantuml.com/sequence-diagram - -@startuml -title User donation - -actor User -participant "Desktop App (UI)" as UI -participant "Donation Service" as DonSvc -participant "Payment Provider" as Pay -database "Donation DB" as DonDB -participant "Organisation Service" as OrgSvc - -User -> UI: Click "Donate" -UI --> User: Show donation form - -User -> UI: Enter amount + confirm -UI -> DonSvc: createDonationIntent(userId, orgId, amount) - -DonSvc -> OrgSvc: validateOrganisation(orgId) -OrgSvc --> DonSvc: OK - -DonSvc -> Pay: createPaymentIntent(amount) -Pay --> DonSvc: paymentIntentId + clientSecret - -DonSvc --> UI: clientSecret -UI -> Pay: Complete payment (clientSecret) -Pay --> UI: Payment success - -UI -> DonSvc: confirmDonation(paymentIntentId) -DonSvc -> Pay: verifyPayment(paymentIntentId) -Pay --> DonSvc: verified OK - -DonSvc -> DonDB: store donation record -DonDB --> DonSvc: stored - -DonSvc --> UI: Donation confirmation -UI --> User: Show "Thank you" + receipt - -@enduml - diff --git a/helpmehelpapplication/User_donation.puml b/helpmehelpapplication/User_donation.puml new file mode 100644 index 00000000..61b56cf6 --- /dev/null +++ b/helpmehelpapplication/User_donation.puml @@ -0,0 +1,40 @@ +@startuml +!theme plain +skinparam backgroundColor white + +title User donation flow in the current application + +actor User +participant "DonationPageController" as DonationPage +participant "JavaFX Alert" as Alert +participant "LoaderScene" as Loader + +User -> DonationPage : Open donation page for selected charity +DonationPage -> DonationPage : setCharity(charity) +DonationPage --> User : Show charity name and amount field + +User -> DonationPage : Enter amount and click Donate +DonationPage -> DonationPage : Validate input + +alt Invalid amount / empty / not numeric / <= 0 / > 100000 + DonationPage -> Alert : showAlert(ERROR or WARNING) + Alert --> User : Show validation message +else Valid amount + DonationPage -> Alert : Show confirmation dialog + Alert --> User : Confirm donation? + + alt User cancels + Alert --> DonationPage : Cancel + DonationPage --> User : Stay on donation page + else User confirms + Alert --> DonationPage : OK + note right of DonationPage + end note + DonationPage -> Alert : showAlert(INFORMATION, "Thank you!") + Alert --> User : Show success message + DonationPage -> DonationPage : clear amount field + DonationPage -> Loader : LoadScene("FrontPage") + Loader --> User : Show front page + end +end +@enduml diff --git a/helpmehelpapplication/View_organisation_details.puml b/helpmehelpapplication/View_organisation_details.puml new file mode 100644 index 00000000..d833aa73 --- /dev/null +++ b/helpmehelpapplication/View_organisation_details.puml @@ -0,0 +1,29 @@ +@startuml +!theme plain +skinparam backgroundColor white + +title User opens an organisation page + +actor User +participant "OrganizationCardController" as Card +participant "LoaderScene" as Loader +participant "CharityPageController" as CharityPage +collections "Selected Charity object" as Charity + +User -> Card : Click organisation card +Card -> Loader : LoadScene("CharityPage", charity) +Loader -> CharityPage : setCharity(charity) +activate CharityPage +CharityPage -> Charity : getName() +Charity --> CharityPage : charity name +CharityPage -> Charity : getDescription() +Charity --> CharityPage : charity description +CharityPage --> User : Show organisation page + +opt User chooses to donate + User -> CharityPage : Click donate + CharityPage -> Loader : LoadScene("donationPage", charity) +end + +deactivate CharityPage +@enduml