Final Sequence Diagrams - bounswe/bounswe2024group4 GitHub Wiki
sequenceDiagram
actor User
participant UserInterface
participant Database
User->>+UserInterface: createPost(content, image)
UserInterface->>Database: post(username, content, image)
alt Success
Database-->>UserInterface: Success.
UserInterface-->>User: Post created successfully.
else Failure
Database-->>UserInterface: <ERR_CODE>
UserInterface-->>User: <ERR_CODE, errorMessage>
end
sequenceDiagram
actor User
User->>+UserInterface: likeUnlikePost(post_id)
UserInterface->>+ Database: likeUnlikePost(username, post_id)
alt Success
alt Post is liked
Database-->>UserInterface: <OK, post_unlikes>
UserInterface-->> User: updatePostLikes(post_id, updated_likes)
else Post is not liked
Database-->>UserInterface: <OK, post_likes>
UserInterface-->> User: updatePostLikes(post_id, updated_likes)
end
else Failure
Database-->>UserInterface: <ERR_CODE>
UserInterface-->> User: displayErrorMessage(ERR_CODE, errorMessage)
end
sequenceDiagram
actor User
User->>+UserInterface: bookmarkUnbookmarkPost(post_id)
UserInterface->>+ Database: bookmarkUnbookmarkPost(username, post_id)
alt Success
alt Post is bookmarked
Database-->>UserInterface: <OK, post_unbookmark>
UserInterface-->> User: updatePostBookmarks(post_id, updated_bookmarks)
else Post is not bookmarked
Database-->>UserInterface: <OK, post_bookmark>
UserInterface-->> User: updatePostBookmark(post_id, updated_bookmarks)
end
else Failure
Database-->>UserInterface: <ERR_CODE>
UserInterface-->> User: displayErrorMessage(ERR_CODE, errorMessage)
end
sequenceDiagram
actor User
User->>+UserInterface: viewPost(post_id)
UserInterface->>+ Database: viewPost(post_id)
alt Success
Database-->>UserInterface: <OK, post, comments>
UserInterface-->> User: displayPost(post)
UserInterface-->> User: displayComments(comments)
else Failure
Database-->>UserInterface: <ERR_CODE>
UserInterface-->> User: displayErrorMessage(ERR_CODE, errorMessage)
end
sequenceDiagram
actor U as User
U->>+UserInterface: comment(post_id, message)
UserInterface->>+ Database: saveComment(username, post_id, message)
alt Success
Database-->>UserInterface: <OK, comments>
UserInterface-->> U: displayComments(comments)
else Error
Database-->>UserInterface: <ERR_CODE, comments>
UserInterface-->> U: displayCommentsWithErr(ERR_CODE, comments)
end
sequenceDiagram
actor User
User->>+FeedController: viewFollowingFeed(username)
FeedController->>+Database: getFollowingFeed(username)
Database-->>FeedController: followingFeed
alt Success
FeedController-->>User: displayFollowingFeed(followingFeed)
else Error
FeedController-->>User: displayErrorMessage("Error retrieving following feed")
end
sequenceDiagram
actor User
User->>+Search: search(query, filters)
Search->>Wikidata API: search(query)
Search->>Database: search(query)
alt Success
Database-->>Search: <OK, results>
alt results.tag is post
Search-->>User : post
else results.tag is username
Search-->>User : username
end
else Fail
Database-->>Search: <ERR_CODE, results>
Search-->>User : ERR_CODE
end
alt Success
Wikidata API-->>Search: <OK, results>
alt results.tag is team
Search-->>User : team.id
Search-->>User : team.logo
Search-->>User : team.name
Search-->>User : team.coach
Search-->>User : team.conference
else results.tag is player
Search-->>User : player.id
Search-->>User : player.name
Search-->>User : player.picture
Search-->>User : player.height
Search-->>User : player.dateOfBirth
end
else
Wikidata API-->>Search: <ERR_CODE, results>
Search-->>User: ERR_CODE
end
sequenceDiagram
actor U as User
U->>+UserInterface: getOtherProfile(username)
UserInterface->>Database: getUsername(username)
Database-->> UserInterface: username
UserInterface->>Database: getProfilePicture(username)
Database-->> UserInterface: profilePicture
UserInterface->>Database: getBio(userID)
Database-->> UserInterface: bio
UserInterface->>Database: getFollowerCount(username)
Database-->> UserInterface: followerCount
UserInterface->>Database: getFollowedCount(username)
Database-->> UserInterface: followedCount
UserInterface->>Database: getPosts(username)
Database-->> UserInterface: posts
UserInterface-->>U: displayOtherProfile(profileInformation)
sequenceDiagram
actor User
User->>+UserInterface: followUser(username)
UserInterface->>+ Database: followUser(username)
alt Success
Database-->>UserInterface: <OK, follower_count>
UserInterface-->> User: updateFollowers(username, updated_follower_count)
else Failure
Database-->>UserInterface: <ERR_CODE>
UserInterface-->> User: displayErrorMessage(ERR_CODE, errorMessage)
end
sequenceDiagram
actor U as User
U->>+Profile: getProfile(userID)
Profile->>Database: getUsername(userID)
Database-->> Profile: username
Profile->>Database: getEmailAddress(userID)
Database-->> Profile: emailAddress
Profile->>Database: getProfilePicture(userID)
Database-->> Profile: profilePicture
Profile->>Database: getBio(userID)
Database-->> Profile: bio
UserInterface->>Database: getFollowerCount(username)
Database-->> UserInterface: followerCount
UserInterface->>Database: getFollowedCount(username)
Database-->> UserInterface: followedCount
UserInterface->>Database: getFollowers(username)
Database-->> UserInterface: followerCount
UserInterface->>Database: getFollowedUsers(username)
Database-->> UserInterface: followedUsers
UserInterface->>Database: getPosts(username)
Database-->> UserInterface: posts
Profile-->>U: displayProfile(profileInformation)
sequenceDiagram
actor U as User
U->>+Profile: changeEmailAddress(userID, newEmailAddress)
alt email address is valid
Profile->>Database: setEmailAddress(userID, newEmailAddress)
alt success
Database-->>Profile: <OK>
Profile-->>U: <OK, successMessage>
else
Database-->>Profile: <ERR_CODE>
Profile-->>U: <ERR_CODE, errorMessage>
end
else
Profile-->>U: <ERR_CODE, invalidMessage>
end
U->>+Profile: changeProfilePicture(userID, newProfilePicture)
alt profile picture is valid
Profile->>Database: setProfilePicture(userID, newProfilePicture)
alt success
Database-->>Profile: <OK>
Profile-->>U: <OK, successMessage>
else
Database-->>Profile: <ERR_CODE>
Profile-->>U: <ERR_CODE, errorMessage>
end
else
Profile-->>U: <ERR_CODE, invalidMessage>
end
U->>+Profile: changeBio(userID, newBio)
alt bio is valid
Profile->>Database: setBio(userID, newBio)
alt success
Database-->>Profile: <OK>
Profile-->>U: <OK, successMessage>
else
Database-->>Profile: <ERR_CODE>
Profile-->>U: <ERR_CODE, errorMessage>
end
else
Profile-->>U: <ERR_CODE, invalidMessage>
end
U->>+Profile: changePassword(userID, newPassword)
alt password is valid
Profile->>Database: setPassword(userID, newPassword)
alt success
Database-->>Profile: <OK>
Profile-->>U: <OK, successMessage>
else
Database-->>Profile: <ERR_CODE>
Profile-->>U: <ERR_CODE, errorMessage>
end
else
Profile-->>U: <ERR_CODE, invalidMessage>
end
sequenceDiagram
actor User
User->>+ UserInterface: viewTeamPage(team_name)
UserInterface->>+ SearchComponent: searchTeam(team_id)
SearchComponent->>+ Wikidata API: requestTeam(query)
alt Success
Wikidata API-->> SearchComponent: <OK, response>
SearchComponent-->> UserInterface: <OK, data>
UserInterface-->> User: displayTeamPage(team_data)
else Failure
Wikidata API-->> SearchComponent: <ERR_CODE, None>
SearchComponent-->> UserInterface: <ERR_CODE>
UserInterface-->> User: displayErrorMessage(ERR_CODE, errorMessage)
end
sequenceDiagram
actor User
User->>+ UserInterface: viewPlayerPage(player_name)
UserInterface->>+ SearchComponent: searchPlayer(player_id)
SearchComponent->>+ Wikidata API: requestPlayer(query)
alt Success
Wikidata API-->> SearchComponent: <OK, response>
SearchComponent-->> UserInterface: <OK, data>
UserInterface-->> User: displayPlayerPage(player_data)
else Failure
Wikidata API-->> SearchComponent: <ERR_CODE, None>
SearchComponent-->> UserInterface: <ERR_CODE>
UserInterface-->> User: displayErrorMessage(ERR_CODE, errorMessage)
end