Skip to content

Commit

Permalink
Merge branch 'develop' of git.ntnu.no:cathrkri/systemutviklingTeam6 i…
Browse files Browse the repository at this point in the history
…nto 56-user-implemention-and-token

# Conflicts:
#	helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/HmHApplication.java
#	helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/AvailableOrganizationController.java
#	helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/CharityPageController.java
#	helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/DonationPageController.java
#	helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/FrontpageController.java
#	helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/components/BaseController.java
#	helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/controller/components/NavbarFooterController.java
#	helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/database/Readers/CharitySelect.java
#	helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/database/Readers/UserSelect.java
#	helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/models/user/User.java
#	helpmehelpapplication/src/main/java/ntnu/systemutvikling/team6/service/AuthenticationService.java
#	helpmehelpapplication/src/main/resources/fxml/aboutPage.fxml
#	helpmehelpapplication/src/main/resources/fxml/charityPage.fxml
#	helpmehelpapplication/src/main/resources/fxml/donationPage.fxml
#	helpmehelpapplication/src/main/resources/fxml/frontPage.fxml
#	helpmehelpapplication/src/main/resources/fxml/profile_org_Inbox.fxml
#	helpmehelpapplication/src/main/resources/fxml/profile_org_Payments.fxml
#	helpmehelpapplication/src/main/resources/fxml/profile_org_Settings.fxml
#	helpmehelpapplication/src/main/resources/fxml/profile_org_edit.fxml
#	helpmehelpapplication/src/main/resources/fxml/profile_user_history.fxml
#	helpmehelpapplication/src/main/resources/fxml/profile_user_inbox.fxml
#	helpmehelpapplication/src/main/resources/fxml/profile_user_interests.fxml
#	helpmehelpapplication/src/main/resources/fxml/profile_user_settings.fxml
  • Loading branch information
AdrianBalunan committed Apr 21, 2026
2 parents 6b4e76f + 22c3355 commit 4da7e5d
Show file tree
Hide file tree
Showing 40 changed files with 1,212 additions and 557 deletions.
46 changes: 46 additions & 0 deletions helpmehelpapplication/App_startup_and_api_sync.puml
Original file line number Diff line number Diff line change
@@ -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
77 changes: 77 additions & 0 deletions helpmehelpapplication/Authentication_backend_flow.puml
Original file line number Diff line number Diff line change
@@ -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
127 changes: 127 additions & 0 deletions helpmehelpapplication/Class_diagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
@startuml
skinparam classAttributeIconSize 0

' ======================
' CONTROLLERS
' ======================
package "Controllers" {
class OrganisationController {
+getAll()
+getById(id)
+search(query)
}

class DonationController {
+createDonation()
+confirmDonation()
}

class AuthController {
+login()
+register()
+logout()
}
}

' ======================
' SERVICES
' ======================
package "Services" {
class OrganisationService {
+getOrganisations()
+getOrganisationDetails()
+searchOrganisations()
}

class DonationService {
+createDonationIntent()
+confirmDonation()
}

class AuthService {
+authenticate()
+createUser()
}

class ScraperService {
+fetchFromAPI()
+enrichData()
}
}

' ======================
' REPOSITORIES
' ======================
package "Repositories" {
class OrganisationRepository {
+findAll()
+findById()
+search()
}

class DonationRepository {
+save()
+findByUser()
}

class UserRepository {
+findByEmail()
+save()
}
}

' ======================
' MODELS / ENTITIES
' ======================
package "Models" {
class Organisation {
id
name
description
category
imageUrl
}

class Donation {
id
amount
userId
organisationId
createdAt
}

class User {
id
email
passwordHash
}
}

' ======================
' RELATIONSHIPS
' ======================

' Controller -> Service
OrganisationController --> OrganisationService
DonationController --> DonationService
AuthController --> AuthService

' Service -> Repository
OrganisationService --> OrganisationRepository
DonationService --> DonationRepository
DonationService --> OrganisationRepository
AuthService --> UserRepository

' Service -> External logic
OrganisationService --> ScraperService

' Repository -> Model
OrganisationRepository --> Organisation
DonationRepository --> Donation
UserRepository --> User

' Model relations
Donation --> User
Donation --> Organisation

@enduml
38 changes: 38 additions & 0 deletions helpmehelpapplication/Frontpage_load.puml
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions helpmehelpapplication/Full_organisation_enrichment_scrape.puml
Original file line number Diff line number Diff line change
@@ -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
31 changes: 0 additions & 31 deletions helpmehelpapplication/Organization_message.puml

This file was deleted.

Loading

0 comments on commit 4da7e5d

Please sign in to comment.