SequenceDiagrams of CMPE451 - bounswe/bounswe2025group5 GitHub Wiki
sequenceDiagram
actor "Registered User"
participant Profile as "Profile Page UI"
participant ProfileController as "Backend Controller"
participant Database
"Registered User"->>Profile: setPhoto(photo)
activate Profile
Profile->>ProfileController: updateProfilePhoto(userId, photo)
activate ProfileController
ProfileController->>Database: update(userId, photoData)
activate Database
Database-->>ProfileController: response (Success/Failure)
deactivate Database
alt response is Success
ProfileController-->>Profile: "Your photo is changed !!"
else response is Failure
ProfileController-->>Profile: "Error: Photo does not meet requirements"
end
deactivate ProfileController
Profile-->>"Registered User": Displays final message and updated photo
deactivate Profile
sequenceDiagram
actor "Registered User"
participant ProfilePage as "UI: Profile Settings"
participant Controller as "Registered User Controller"
participant Database
"Registered User"->>ProfilePage: Clicks "Delete Account" and confirms
activate ProfilePage
ProfilePage->>Controller: deleteAccount(userId, password)
activate Controller
Controller->>Database: deleteByName(userId, password)
activate Database
Database-->>Controller: Deletion Status (Success/Failure)
deactivate Database
alt Deletion Status is Success
Controller-->>ProfilePage: Success
else Deletion Status is Failure
Controller-->>ProfilePage: Failure
end
deactivate Controller
alt Success
ProfilePage-->>"Registered User": "Account successfully deleted."
Note over ProfilePage, "Registered User": User is logged out and redirected.
else Failure
ProfilePage-->>"Registered User": Error: "Deletion failed. Please check credentials."
end
deactivate ProfilePage
sequenceDiagram
actor User
participant App as "Profile Page UI"
participant FollowController as "Backend Controller"
participant Database
User->>App: Clicks "Follow" button
activate App
App->>FollowController: createFollow(followerId, followedId)
activate FollowController
FollowController->>Database: Insert Follow Relationship
activate Database
Database-->>FollowController: Confirmation (Success/Failure)
deactivate Database
FollowController-->>App: Status (Success/Failure)
deactivate FollowController
alt Success
App-->>User: Update button to "Unfollow"
else Failure
App-->>User: Show error message
end
deactivate App
sequenceDiagram
actor User
participant App as "Profile Page UI"
participant FollowController as "Backend Controller"
participant Database
User->>App: Clicks "Unfollow" button
activate App
App->>FollowController: deleteFollow(followerId, followedId)
activate FollowController
FollowController->>Database: Delete Follow Relationship
activate Database
Database-->>FollowController: Confirmation (Success/Failure)
deactivate Database
FollowController-->>App: Status (Success/Failure)
deactivate FollowController
alt Success
App-->>User: Update button to "Follow"
else Failure
App-->>User: Show error message
end
deactivate App
sequenceDiagram
actor Moderator
participant ModeratorClass as Moderator Class
participant Database
Moderator->>ModeratorClass: approveRequestedChallenge(challengeId)
activate ModeratorClass
ModeratorClass->>Database: activate(challengeId)
activate Database
Database-->>ModeratorClass: status
deactivate Database
alt status = 2
ModeratorClass-->>Moderator: Already active challenge
else status = 0
ModeratorClass-->>Moderator: No requested challenge
else status = 1
ModeratorClass-->>Moderator: Activated
end
deactivate ModeratorClass
sequenceDiagram
participant User
participant App
participant Challenge
participant Database
User ->> App: Request to Join Challenge (challengeId)
App ->> Database: Check if Challenge Exists (challengeId)
Database -->> App: Challenge Exists? (Yes/No)
alt Challenge Not Found
App -->> User: Error: Challenge Not Found
else Challenge Exists
App ->> Challenge: addParticipant(userId)
Challenge ->> Database: Store Participant Entry
Database -->> Challenge: Confirmation
Challenge -->> App: Success
App -->> User: Successfully Joined Challenge
end
sequenceDiagram
participant User
participant App
participant Challenge
participant Database
User ->> App: Request to Log Waste (challengeId, amount, wasteType)
App ->> Database: Check if User is Participant (userId, challengeId)
Database -->> App: Is Participant? (Yes/No)
alt User is not a participant
App -->> User: Error: You must join the challenge to log waste
else User is a participant
App ->> Challenge: updateProgress(userId, amount, wasteType)
activate Challenge
Challenge ->> Database: Store Progress Entry
activate Database
Database -->> Challenge: Confirmation
deactivate Database
Challenge -->> App: Success
deactivate Challenge
App -->> User: Successfully Logged Waste
end
sequenceDiagram
actor U as User
participant RU as RegisteredUser
participant WG as WasteGoal
U ->> RU: viewGoals(userId)
activate RU
RU -->> U: return List<WasteGoal>
deactivate RU
U ->> RU: createWasteGoal(name, duration, type, amount)
activate RU
RU ->> WG: new WasteGoal(...)
activate WG
WG -->> RU: return instance
deactivate WG
RU -->> U: return "Goal created successfully"
deactivate RU
sequenceDiagram
actor Registered User
participant ForumFeed as ForumFeed
participant Wikidata
Registered User->>ForumFeed: search(prompt)
activate ForumFeed
ForumFeed->>Wikidata: semanticSearch(prompt)
activate Wikidata
Wikidata-->>ForumFeed: response
deactivate Wikidata
alt response=no result
ForumFeed-->>Registered User: "No result found"
else response=result
ForumFeed-->>Registered User: results
end
deactivate ForumFeed