Sequence Diagram 1: Goals - bounswe/bounswe2025group2 GitHub Wiki
Below, you can find the sequence diagrams for the Goal mechanism. You can also visit this page for the use case diagrams of the goal mechanism in order to understand what they are actually used for.
User Setting a Goal
sequenceDiagram
actor User as Registered User
participant Goal as Goal
participant DB as Database
User ->> Goal: setGoal(type, amount, unit, title, description)
Goal ->> DB: saveGoal(type, amount, unit, title, description)
rect rgb(40, 40, 40)
alt All fields valid
DB -->> Goal: success: goal saved
Goal -->> User: return success
else Invalid or missing field
DB -->> Goal: error: validation failed
Goal -->> User: return error
end
end
User Updating a Goal
sequenceDiagram
actor User as Registered User
participant Goal as Goal
participant DB as Database
participant Notif as Notification Service
User ->> Goal: updateGoal(id, {type|amount|unit|title|description|progress})
rect rgb(40, 40, 40)
alt Editing existing goal fields
Goal ->> DB: updateGoal(id, updatedFields)
DB -->> Goal: success: goal updated
Goal ->> Notif: sendNotification(userId, "Goal updated")
Notif -->> Goal: notification sent
Goal -->> User: return success
else Adding progress
Goal ->> DB: progressGoal(id, quantity)
DB -->> Goal: success: progress updated
Goal ->> Notif: sendNotification(userId, "Progress added")
Notif -->> Goal: notification sent
Goal -->> User: return success
else Completing goal
Goal ->> DB: completeGoal(id)
DB -->> Goal: success: goal completed
Goal ->> Notif: sendNotification(userId, "Goal completed")
Notif -->> Goal: notification sent
Goal -->> User: return success
else Deleting goal
Goal ->> DB: deleteGoal(id)
DB -->> Goal: success: goal deleted
Goal -->> User: return success
else Error
DB -->> Goal: error: update failed
Goal -->> User: return error
end
end
Mentor Setting a Goal for His/Her Mentee
sequenceDiagram
actor Mentor as Registered Mentor
participant Goal as Goal
participant DB as Database
Mentor ->> Goal: seeMenteeGoals(mentor_id)
Goal ->> DB: getMenteeGoals(mentor_id)
DB -->> Goal: list of mentee goals
Goal -->> Mentor: mentee goals list
Mentor ->> Goal: setMenteeGoal(mentee_id, type, amount, unit, title, description)
Goal ->> DB: saveGoal(mentee_id, type, amount, unit, title, description)
rect rgb(40, 40, 40)
alt Valid input provided
DB -->> Goal: success: goal saved
Goal -->> Mentor: return success
else Invalid input
DB -->> Goal: error: validation failed
Goal -->> Mentor: return error
end
end