Sequence Diagrams ‐ CMPE451 - bounswe/bounswe2024group12 GitHub Wiki

1. User Account Management

1.1 Sign Up

sequenceDiagram
    actor U as User
    participant S as System
    participant DB as Database
    participant E as Email Service
    
    %signup
    U->>S: signUp(username, email, password)
    S->>DB: Store new user details
    DB-->>S: Success
    S->>E: Send email verification
    E-->>U: Verification email sent
    U->>E: Click verification link
    E->>S: Verify email
    S->>DB: Activate account
    DB-->>S: Account activated
    S-->>U: Account creation successful

1.2 Log In

sequenceDiagram
    actor U as User
    participant S as System
    participant DB as Database
    
    %login
    U->>S: logIn(username, password)
    S->>DB: Verify credentials
    alt Valid
        DB-->>S: Valid credentials
        S-->>U: Login successful
    else Invalid
        DB-->>S: Invalid credentials
        S-->>U: Login failed
    end

1.3 Log Out

sequenceDiagram
    actor U as User
    participant S as System
    
    %logout
    U->>S: logOut()
    alt Successful
        S-->>U: Logout successful
    else Failure
        S-->>U: Logout failed
    end

1.4 Delete Account

sequenceDiagram
    actor U as User
    participant S as System
    participant DB as Database
    
    %delete account
    U->>S: deleteAccount()
    S->>DB: Remove user data
    alt Successful
        DB-->>S: Account deleted
        S-->>U: Deletion successful
    else Failure
        DB-->>S: Deletion failed
        S-->>U: Deletion failed
    end

1.5 Reset Password

sequenceDiagram
    actor U as User
    participant S as System
    participant DB as Database
    participant E as Email Service
    
    %reset password
    U->>S: resetPassword(email)
    S->>E: Send reset email
    E-->>U: Reset email sent
    U->>E: Click reset link
    E->>S: Confirm password reset
    S->>DB: Update password
    DB-->>S: Password updated
    S-->>U: Reset successful

1.6 Change Password

sequenceDiagram
    actor U as User
    participant S as System
    participant DB as Database
    
    %change password
    U->>S: changePassword(oldPassword, newPassword)
    S->>DB: Verify old password and update to new one
    alt Successful
        DB-->>S: Password updated
        S-->>U: Password change successful
    else Failure
        DB-->>S: Update failed
        S-->>U: Password change failed
    end

1.7 Email Verification

sequenceDiagram
    actor U as User
    participant S as System
    participant E as Email Service
    participant DB as Database
    
    %email verification
    U->>S: requestEmailVerification()
    S->>E: Send verification email
    E-->>U: Verification email sent
    U->>E: Click verification link
    E->>S: Verify user email
    S->>DB: Update account as verified
    DB-->>S: User verified
    S-->>U: Verification successful

2. Leveling System

2.1 Assign Level Based on Forum Rating

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %level assignment
    U->>S: Interact with forum (posts, likes)
    S->>DB: Calculate forum rating
    DB-->>S: Update user level
    S-->>U: User level updated

2.2 Forum Rating Accumulation

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %forum rating accumulation
    U->>S: Post content, like, or comment
    S->>DB: Update forum rating
    DB-->>S: Rating updated
    S-->>U: Forum rating updated

3. Social Interaction

3.1 Follow/Unfollow Users

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %follow
    U->>S: followUser(targetUser)
    S->>DB: Update follow list
    alt Success
        DB-->>S: Follow successful
        S-->>U: Follow successful
    else Failure
        DB-->>S: Follow failed
        S-->>U: Follow failed
    end

3.2 Unfollow Users

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %unfollow
    U->>S: unfollowUser(targetUser)
    S->>DB: Update follow list
    alt Success
        DB-->>S: Unfollow successful
        S-->>U: Unfollow successful
    else Failure
        DB-->>S: Unfollow failed
        S-->>U: Unfollow failed
    end

3.3 Legend User Interactions (Likes/Dislikes, Puzzle Upvotes/Downvotes)

sequenceDiagram
    actor LU as Legend User
    participant S as System
    participant DB as Database
    
    %legend interactions
    LU->>S: likePost(postId) / upvotePuzzle(puzzleId)
    S->>DB: Register like/dislike or upvote/downvote with legend status
    DB-->>S: Interaction registered
    S-->>LU: Interaction successful

3.4 Receive Notifications for Follows, Likes, Comments

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %receive notifications
    U->>S: Follow user or comment on a post
    S->>DB: Register interaction
    DB-->>S: Interaction registered
    S-->>U: Notification sent for follow, like, or comment

4. Content Interaction

4.1 Create Post

sequenceDiagram
    actor SU as Specialist User
    participant S as System
    participant DB as Database
    
    %create post
    SU->>S: submitPost(postContent)
    S->>DB: Validate and store post
    alt Success
        DB-->>S: Post stored
        S-->>SU: Post successfully created
    else Failure
        DB-->>S: Post storage failed
        S-->>SU: Post creation failed
    end

4.2 Like/Dislike Post

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %like/dislike post
    U->>S: likePost(postId)
    S->>DB: Update post engagement
    DB-->>S: Engagement updated
    S-->>U: Like/Dislike recorded

4.3 Comment on Post

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %comment on post
    U->>S: submitComment(postId, commentContent)
    S->>DB: Validate and store comment
    alt Success
        DB-->>S: Comment stored
        S-->>U: Comment successfully added
    else Failure
        DB-->>S: Comment storage failed
        S-->>U: Comment creation failed
    end

4.4 Filter Posts by Tags

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %filter posts by tags
    U->>S: filterPosts(tag)
    S->>DB: Retrieve posts with tag
    DB-->>S: Posts retrieved
    S-->>U: Display filtered posts

4.5 Bookmark Post

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %bookmark post
    U->>S: bookmarkPost(postId)
    S->>DB: Update bookmark list
    DB-->>S: Bookmark added
    S-->>U: Post bookmarked

4.6 Retweet/Share Post

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %share post
    U->>S: retweetPost(postId)
    S->>DB: Share post content
    alt Success
        DB-->>S: Post shared
        S-->>U: Post retweeted
    else Failure
        DB-->>S: Sharing failed
        S-->>U: Share failed
    end

4.7 Explore Game Archive

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %explore game archive
    U->>S: exploreGame(gameId)
    S->>DB: Retrieve game details
    DB-->>S: Game data retrieved
    S-->>U: Display game on visual chessboard

4.8 Comment on Game Position

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %comment on game position
    U->>S: commentOnGamePosition(gameId, position, comment)
    S->>DB: Validate and store comment
    alt Success
        DB-->>S: Comment stored
        S-->>U: Comment added to game position
    else Failure
        DB-->>S: Comment storage failed
        S-->>U: Comment addition failed
    end

4.9 Play Puzzle

sequenceDiagram
    actor U as Registered User
    participant S as System
    
    %play puzzle
    U->>S: playPuzzle(puzzleId)
    S-->>U: Puzzle displayed, user plays

4.10 Create Puzzle

sequenceDiagram
    actor EU as Expert User
    participant S as System
    participant DB as Database
    
    %create puzzle
    EU->>S: createPuzzle(puzzleData)
    S->>DB: Validate and store puzzle
    alt Success
        DB-->>S: Puzzle stored
        S-->>EU: Puzzle successfully created
    else Failure
        DB-->>S: Puzzle storage failed
        S-->>EU: Puzzle creation failed
    end

4.11 Upvote/Downvote Puzzle

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %upvote/downvote puzzle
    U->>S: votePuzzle(puzzleId, voteType)
    S->>DB: Register vote
    DB-->>S: Vote registered
    S-->>U: Vote successful

5. Search

5.1 Perform Full-Text Search

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %perform search
    U->>S: search(term)
    S->>DB: Search database for term
    alt Success
        DB-->>S: Return search results
        S-->>U: Display results
    else Failure
        DB-->>S: No results found
        S-->>U: No matching results
    end

5.2 Faceted Filtering

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %faceted filtering
    U->>S: applyFilters(filters)
    S->>DB: Retrieve content with filters
    DB-->>S: Filtered content retrieved
    S-->>U: Display filtered results

5.3 Autocomplete Search Suggestions

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %autocomplete suggestions
    U->>S: start typing search query
    S->>DB: Fetch autocomplete suggestions
    DB-->>S: Suggestions fetched
    S-->>U: Display suggestions in search bar

5.4 Result Categorization

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %result categorization
    U->>S: search(term)
    S->>DB: Categorize results (posts, users, games)
    DB-->>S: Categorized results fetched
    S-->>U: Display categorized search results

6. Analysis Tool

6.1 Input Moves for Analysis

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant CE as Chess Engine
    
    %input moves for analysis
    U->>S: inputMove(position)
    S->>CE: Send move to chess engine
    CE-->>S: Return evaluation
    S-->>U: Display move analysis

6.2 Toggle Engine Analysis On/Off

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant CE as Chess Engine
    
    %toggle engine analysis
    U->>S: toggleEngineAnalysis(on/off)
    S->>CE: Start/Stop engine analysis
    CE-->>S: Engine toggled
    S-->>U: Analysis toggled

6.3 Import PGN Files

sequenceDiagram
    actor U as Registered User
    participant S as System
    
    %import PGN
    U->>S: importPGN(pgnFile)
    S-->>U: PGN file imported successfully

6.4 Export Analyzed Games as PGN

sequenceDiagram
    actor U as Registered User
    participant S as System
    
    %export PGN
    U->>S: exportPGN(gameId)
    S-->>U: PGN file exported successfully

6.5 Share Analysis Boards or Positions

sequenceDiagram
    actor U as Registered User
    participant S as System
    
    %share analysis
    U->>S: shareAnalysis(boardPosition)
    S-->>U: Shareable link generated

6.6 Blunder Detection

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant CE as Chess Engine
    
    %blunder detection
    U->>S: analyzeMoveForBlunder(position)
    S->>CE: Send move to engine for blunder detection
    CE-->>S: Return blunder analysis
    S-->>U: Blunder detected and highlighted

6.7 Opening Explorer

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %opening explorer
    U->>S: exploreOpening(openingName)
    S->>DB: Retrieve opening variations
    DB-->>S: Opening variations returned
    S-->>U: Display opening explorer

6.8 Endgame Tablebases

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %endgame tablebases
    U->>S: accessEndgameTablebases(position)
    S->>DB: Retrieve endgame tablebases
    DB-->>S: Endgame tablebases data returned
    S-->>U: Display endgame analysis

6.9 Move Annotation and Commenting

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %move annotation
    U->>S: addAnnotationToMove(gameId, move, annotation)
    S->>DB: Store annotation
    DB-->>S: Annotation saved
    S-->>U: Annotation added successfully

6.10 Semantic Browsing for Analyzed Positions

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    
    %semantic browsing
    U->>S: browseGamesForPosition(position)
    S->>DB: Retrieve games with the same position
    DB-->>S: Games retrieved
    S-->>U: Display top games with similar position

7. Moderation

7.1 Report Content

sequenceDiagram
    actor U as Registered User
    participant S as System
    participant DB as Database
    participant A as Admin
    
    %report content
    U->>S: reportContent(contentId, reason)
    S->>DB: Log report
    A->>S: Review report
    alt Approved
        A->>S: Take action on content
        S->>DB: Update content status
        DB-->>S: Action applied
        S-->>U: Report processed successfully
    else Rejected
        S-->>U: Report rejected
    end

7.2 Ban/Unban User

sequenceDiagram
    actor A as Admin
    participant S as System
    participant DB as Database
    
    %ban/unban user
    A->>S: banUser(userId, period) / unbanUser(userId)
    S->>DB: Update user status
    alt Success
        DB-->>S: User status updated
        S-->>A: Ban/Unban successful
    else Failure
        DB-->>S: Update failed
        S-->>A: Ban/Unban failed
    end

7.3 Admin Delete/Edit Post or Comment

sequenceDiagram
    actor A as Admin
    participant S as System
    participant DB as Database
    
    %delete/edit post
    A->>S: deleteOrEditPost(postId, newContent)
    S->>DB: Apply changes
    alt Success
        DB-->>S: Changes applied
        S-->>A: Post/Comment successfully deleted or edited
    else Failure
        DB-->>S: Changes failed
        S-->>A: Post/Comment modification failed
    end

7.4 Pin/Feature Post

sequenceDiagram
    actor A as Admin
    participant S as System
    participant DB as Database
    
    %pin/feature post
    A->>S: pinOrFeaturePost(postId)
    S->>DB: Update post visibility
    alt Success
        DB-->>S: Post visibility updated
        S-->>A: Post successfully pinned or featured
    else Failure
        DB-->>S: Update failed
        S-->>A: Post modification failed
    end

7.5 Change User Profile Picture

sequenceDiagram
    actor A as Admin
    participant S as System
    participant DB as Database
    
    %change profile picture
    A->>S: changeProfilePicture(userId, newPicture)
    S->>DB: Update profile picture
    alt Success
        DB-->>S: Picture updated
        S-->>A: Profile picture changed successfully
    else Failure
        DB-->>S: Update failed
        S-->>A: Profile picture change failed
    end

7.6 Approve/Reject Flagged Content

sequenceDiagram
    actor A as Admin
    participant S as System
    participant DB as Database
    
    %approve/reject flagged content
    A->>S: reviewFlaggedContent(contentId)
    S->>DB: Approve/Reject content
    alt Success
        DB-->>S: Content updated
        S-->>A: Flagged content processed
    else Failure
        DB-->>S: Processing failed
        S-->>A: Action failed
    end

7.7 Delete User Account

sequenceDiagram
    actor A as Admin
    participant S as System
    participant DB as Database
    
    %delete user account
    A->>S: deleteUserAccount(userId)
    S->>DB: Remove user data
    alt Success
        DB-->>S: Account deleted
        S-->>A: User account deleted successfully
    else Failure
        DB-->>S: Deletion failed
        S-->>A: User account deletion failed
    end

7.8 Change User Status (Banned/Unbanned)

sequenceDiagram
    actor A as Admin
    participant S as System
    participant DB as Database
    
    %change user status
    A->>S: changeUserStatus(userId, status)
    S->>DB: Update user status
    alt Success
        DB-->>S: Status updated
        S-->>A: User status changed successfully
    else Failure
        DB-->>S: Update failed
        S-->>A: Status change failed
    end