CMPE 352 ‐ Sequence Diagrams Draft - bounswe/bounswe2024group8 GitHub Wiki

Post

Create

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User->>UserInterface: createPost(title, content)
  UserInterface->>Database: savePost(user_id, title, content)
  alt Success
    Database-->>UserInterface: <OK>
    UserInterface-->>User: Post created successfully.
  else Failure
    Database-->>UserInterface: <ERR_CODE>
    UserInterface-->>User: <ERR_CODE, errorMessage>
  end
Loading

Delete

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User ->>UserInterface: deletePost(post_id)
  UserInterface->>Database: deletePost(post_id)
  alt Success
   Database-->>UserInterface: <OK>
   UserInterface-->>User: Post deleted successfully.
  else Failure
   Database-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end
Loading

View

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User ->>UserInterface: viewPost(post_id)
  UserInterface->>Database: viewPost(post_id)
  alt Success
   Database-->>UserInterface: <OK, content, comments>
   UserInterface-->>User: displayContent(content)
   UserInterface-->>User: displayComments(comments)
  else Failure
   Database-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end
Loading

Like

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User ->>UserInterface: likePost(post_id, value)
  UserInterface->>Database: likePost(user_id, post_id, value)
  alt Success
   Database-->>UserInterface: <OK, post_likes>
   UserInterface-->>User: displayPostLikes(post_id)
  else Failure
   Database-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end
Loading

Bookmark

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User ->>UserInterface: bookmarkPost(post_id)
  UserInterface->>Database: bookmarkPost(user_id, post_id)
  alt Success
   Database-->>UserInterface: <OK>
   UserInterface-->>User: Bookmark added successfully.
  else Failure
   Database-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end

Loading

Comment

Create

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User->>UserInterface: createComment(post_id, content)
  UserInterface->>Database: saveComment(user_id, post_id, content)
  alt Success
    Database-->>UserInterface: <OK>
    UserInterface-->>User: Comment created successfully.
  else Failure
    Database-->>UserInterface: <ERR_CODE>
    UserInterface-->>User: <ERR_CODE, errorMessage>
  end
Loading

Delete

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User->>UserInterface: deleteComment(post_id, comment_id)
  UserInterface->>Database: deleteComment(post_id, comment_id)
  alt Success
    Database-->>UserInterface: <OK>
    UserInterface-->>User: Comment deleted successfully.
  else Failure
    Database-->>UserInterface: <ERR_CODE>
    UserInterface-->>User: <ERR_CODE, errorMessage>
  end
Loading

Like

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User ->>UserInterface: likeComment(post_id, comment_id, value)
  UserInterface->>Database: likeComment(user_id, post_id, comment_id, value)
  alt Success
   Database-->>UserInterface: <OK, comment_likes>
   UserInterface-->>User: displayCommentLikes(post_id, comment_id)
  else Failure
   Database-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end
 
Loading

Feed

View Latest

sequenceDiagram
  actor User
  participant UserInterface
  participant FeedController
  participant Database

  User ->>UserInterface: viewLatest(user_id)
  UserInterface->>FeedController: fetchLatest(user_id)
  FeedController->>Database: fetchLatest(user_id)
  alt Success
   Database-->>FeedController: <OK, latest>
   FeedController-->>UserInterface: <latest>
   UserInterface-->>User: displayLatestFeed(latest)
  else Failure
   Database-->>FeedController: <ERR_CODE>
   FeedController-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end
 
Loading

View Following

sequenceDiagram
  actor User
  participant UserInterface
  participant FeedController
  participant Database

  User ->>UserInterface: viewFollowing(user_id)
  UserInterface->>FeedController: fetchFollowing(user_id)
  FeedController->>Database: fetchFollowing(user_id)
  alt Success
   Database-->>FeedController: <OK, following>
   FeedController-->>UserInterface: <following>
   UserInterface-->>User: displayFollowingFeed(following)
  else Failure
   Database-->>FeedController: <ERR_CODE>
   FeedController-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end
 
Loading

Community

Subscribe

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User ->>UserInterface: subscribeCommunity(user_id, community_id)
  UserInterface->>Database: addSubscriber(user_id, community_id)
  alt Success
   Database-->>UserInterface: <OK>
   UserInterface-->>User: Subscribed to community successfully.
  else Failure
   Database-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end
 
Loading

Unsubscribe

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User ->>UserInterface: unsubscribeCommunity(user_id, community_id)
  UserInterface->>Database: removeSubscriber(user_id, community_id)
  alt Success
   Database-->>UserInterface: <OK>
   UserInterface-->>User: Unsubscribed from community successfully.
  else Failure
   Database-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end
 
Loading

User Interactions

View User

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User ->>UserInterface: viewProfile(user_id)
  UserInterface->>Database: fetchProfile(user_id)
  alt Success
   Database-->>UserInterface: <OK, details, posts, comments>
   UserInterface-->>User: displayProfile(details, posts, comments)
  else Failure
   Database-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end
 
Loading

Follow User

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User ->>UserInterface: followUser(user_id, value)
  UserInterface->>Database: followUser(user_id, value)
  alt Success
   Database-->>UserInterface: <OK, follower_count>
   UserInterface-->>User: displayFollowers(follower_count)
  else Failure
   Database-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end
 
Loading

Account

View Own Profile

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User ->>UserInterface: viewOwnProfile(user_id)
  UserInterface->>Database: fetchOwnProfile(user_id)
  alt Success
   Database-->>UserInterface: <OK, details, posts, comments>
   UserInterface-->>User: displayProfile(details, posts, comments)
  else Failure
   Database-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end
 
Loading

Edit Profile

sequenceDiagram
  actor User
  participant UserInterface
  participant Database

  User ->>UserInterface: updateAttribute(user_id, attribute)
  UserInterface->>Database: updateAttribute(user_id, attribute)
  alt Success
   Database-->>UserInterface: <OK, attribute>
   UserInterface-->>User: displayAttribute(attribute)
  else Failure
   Database-->>UserInterface: <ERR_CODE>
   UserInterface-->>User: <ERR_CODE, errorMessage>
  end
 
Loading

Search

sequenceDiagram
    participant User
    participant UserInterface
    participant WikidataAPI
    participant Database
    

    User->>UserInterface: search(query)
    UserInterface->>WikidataAPI: fetchKeywords(query)

    alt Keywords
     WikidataAPI-->>Database: searchDatabase(query, keywords)
    else No Keywords
     WikidataAPI-->>Database: searchDatabase(query)
    end
   
    alt Success
     Database-->>UserInterface: <OK, results>
     UserInterface-->>User: displayResults(results)
    else Failure
     Database-->>UserInterface: <ERR_CODE>
     UserInterface-->>User: <ERR_CODE, message>
    end

Loading

Prepared By Oğuz Kağnıcı

⚠️ **GitHub.com Fallback** ⚠️