Sequence Diagrams - bounswe/bounswe2024group4 GitHub Wiki
sequenceDiagram
actor User
participant UserInterface
participant Database
User->>UserInterface: createPost(title, content)
UserInterface->>Database: post(userID, title, content)
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
participant UserInterface
participant Database
User->>UserInterface: deletePost(postID)
UserInterface->>Database: deletePost(postID)
alt Success
Database-->>UserInterface: Success.
UserInterface-->>User: Post deleted successfully.
else Failure
Database-->>UserInterface: <ERR_CODE>
UserInterface-->>User: <ERR_CODE, errorMessage>
end
sequenceDiagram
actor User
User->>+UserInterface: likePost(post_id)
UserInterface->>+ Database: likePost(user_id, post_id)
alt Success
Database-->>UserInterface: <OK, post_likes>
UserInterface-->> User: updatePostLikes(post_id, updated_likes)
else Failure
Database-->>UserInterface: <ERR_CODE>
UserInterface-->> User: displayErrorMessage(ERR_CODE, errorMessage)
end
sequenceDiagram
actor User
User->>+UserInterface: BookmarkPost(post_id)
UserInterface->>+ Database: bookmarkPost(user_id, post_id)
alt Success
Database-->>UserInterface: <OK, post_bookmarked>
UserInterface-->> User: Post bookmarked successfully.
else Failure
Database-->>UserInterface: <ERR_CODE>
UserInterface-->> User: displayErrorMessage(ERR_CODE, errorMessage)
end
sequenceDiagram
actor User
User->>+UserInterface: RemoveBookmarkPost(post_id)
UserInterface->>+ Database: removeBookmarkPost(user_id, post_id)
alt Success
Database-->>UserInterface: <OK, post_bookmark_deleted>
UserInterface-->> User: Post unbookmarked successfully.
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(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 U as User
U->>+UserInterface: deleteComment(post_id, comment_id)
UserInterface->>+ Database: deleteComment(post_id, comment_id)
alt Success
Database-->>UserInterface: <OK>
UserInterface-->> U: displaySuccessMessage("Comment deleted successfully")
else Error
Database-->>UserInterface: <ERR_CODE>
UserInterface-->> U: displayErrorMessage("Error occurred while deleting comment")
end
sequenceDiagram
actor U as User
U->>+UserInterface: likeComment(post_id, comment_id)
UserInterface->>+ Database: likeComment(post_id, comment_id)
alt Success
Database-->>UserInterface: <OK, updated_likes>
UserInterface-->> U: updateLikesCount(comment_id, updated_likes)
else Error
Database-->>UserInterface: <ERR_CODE>
UserInterface-->> U: displayErrorMessage("Error occurred while liking comment")
end
sequenceDiagram
actor User
User->>+FeedController: viewGeneralFeed(userID)
FeedController->>+Database: getGeneralFeed(userID)
Database-->>FeedController: generalFeed
alt Success
FeedController-->>User: displayGeneralFeed(generalFeed)
else Error
FeedController-->>User: displayErrorMessage("Error retrieving general feed")
end
sequenceDiagram
actor User
User->>+FeedController: viewFollowingFeed(userID)
FeedController->>+Database: getFollowingFeed(userID)
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: similaritySearch(query)
Search->>Filter: apply(filters)
Database->>Filter: filter(results)
alt Success
Filter-->>Search: <OK, results>
Search-->>User : entry
else Fail
Filter-->>Search: <ERR_CODE, results>
Search-->>User : ERR_CODE
end
alt Success
Wikidata API-->>Search: <OK, results>
alt results.tag is team
Search-->>User : team page
else results.tag is player
Search-->>User : player page
end
else
Wikidata API-->>Search: <ERR_CODE, results>
Search-->>User: ERR_CODE
end
sequenceDiagram
actor U as User
U->>+UserInterface: getOtherProfile(userID)
UserInterface->>Database: getUsername(userID)
Database-->> UserInterface: username
UserInterface->>Database: getProfilePicture(userID)
Database-->> UserInterface: profilePicture
UserInterface->>Database: getBio(userID)
Database-->> UserInterface: bio
UserInterface->>Database: getFollowerCount(userID)
Database-->> UserInterface: followerCount
UserInterface-->>U: displayOtherProfile(profileInformation)
alt allowed to view
UserInterface->>Database: getPosts(userID)
Database-->> UserInterface: <OK, posts>
UserInterface-->>U: displayPosts(posts)
else not allowed
Database-->> UserInterface: <ERR_CODE>
UserInterface-->>U: <ERR_CODE, disallowanceMessage>
end
sequenceDiagram
actor User
User->>+UserInterface: followUser(user_id)
UserInterface->>+ Database: followUser(user_id)
alt Success
Database-->>UserInterface: <OK, follower_count>
UserInterface-->> User: updateFollowers(user_id, 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
Profile-->>U: displayProfile(profileInformation)
sequenceDiagram
actor U as User
U->>+Profile: changeUsername(userID, newUsername)
alt username is valid
Profile->>Database: setUsername(userID, newUsername)
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: 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