Skip to content

Final Sequence Diagrams

Oğuz Kağnıcı edited this page May 18, 2024 · 1 revision

Post

Create

sequenceDiagram
  actor User
  participant PostController
  participant PostService
  participant PostRepository
  participant Database

  User->>PostController: create(PostCreateRequest)
  PostController->>PostService: create(User, PostCreateRequest)
  PostService->>PostRepository: save(Post)
  PostRepository->>Database: Post
  alt Success
    PostService-->>PostController: <OK, Post>
    PostController-->>User: Post
  else Failure
    PostService-->>PostController: <ERR_CODE>
    PostController-->>User: <ERR_CODE, errorMessage>
  end
Loading

Get

sequenceDiagram
  actor User
  participant PostController
  participant PostService
  participant PostRepository
  participant Database

  User->>PostController: getPost()
  PostController->>PostService: getPost(User)
  PostService->>PostRepository: findPosts(User)
  alt Success
    Database-->>PostService: Posts
    PostService-->>PostController: <OK, Posts>
    PostController-->>User: Posts
  else Failure
    PostService-->>PostController: <ERR_CODE>
    PostController-->>User: <ERR_CODE, errorMessage>
  end
Loading

React

sequenceDiagram
  actor User
  participant PostController
  participant PostService
  participant PostRepository
  participant ReactionRepository
  participant Database

  User->>PostController: reactPost(postId, ReactionRequest)
  PostController->>PostService: reactToPost(User, postId, ReactionRequest)
  PostService->>PostRepository: save(Post)
  PostService->>ReactionRepository: save(Reaction)
  ReactionRepository->>Database: Reaction
  PostRepository->>Database: Post
  alt Success
    PostService-->>PostController: <OK, Reaction>
    PostController-->>User: Reaction
  else Failure
    PostService-->>PostController: <ERR_CODE>
    PostController-->>User: <ERR_CODE, errorMessage>
  end
Loading

Comment

Create

sequenceDiagram
  actor User
  participant PostController
  participant CommentService
  participant CommentRepository
  participant PostRepository
  participant Database

  User->>PostController: createComment(CommentCreateRequest)
  PostController->>CommentService: createComment(User, CommentCreateRequest)
  CommentService->>PostRepository: save(Post)
  CommentService->>CommentRepository: save(Comment)
  CommentRepository->>Database: Comment
  PostRepository->>Database: Post
  alt Success
    CommentService-->>PostController: <OK, Comment>
    PostController-->>User: Reaction
  else Failure
    CommentService-->>PostController: <ERR_CODE>
    PostController-->>User: <ERR_CODE, errorMessage>
  end
Loading

React

sequenceDiagram
  actor User
  participant PostController
  participant CommentService
  participant CommentRepository
  participant ReactionRepository
  participant Database

  User->>PostController: reactComment(commented, ReactionType)
  PostController->>CommentService: reactToComment(User, commentId, ReactionType)
  CommentService->>CommentRepository: save(Comment)
  CommentService->>ReactionRepository: save(Reaction)
  ReactionRepository->>Database: Reaction
  CommentRepository->>Database: Comment
  alt Success
    CommentService-->>PostController: <OK, Reaction>
    PostController-->>User: Reaction
  else Failure
    CommentService-->>PostController: <ERR_CODE>
    PostController-->>User: <ERR_CODE, errorMessage>
  end
Loading

Feed

View

sequenceDiagram
  actor User
  participant PostController
  participant PostService
  participant PostRepository
  participant Database

  User->>PostController: getFeed()
  PostController->>PostService: getFeed(User)
  PostService->>PostRepository: findPostsUser(User)
  alt Success
    Database-->>PostService: Posts
    PostService-->>PostController: <OK, Posts>
    PostController-->>User: Posts
  else Failure
    PostService-->>PostController: <ERR_CODE>
    PostController-->>User: <ERR_CODE, errorMessage>
  end
Loading

Community

View

sequenceDiagram
  actor User
  participant PostController
  participant PostService
  participant PostRepository
  participant Database

  User->>PostController: getPostsOfCommunity(communityId)
  PostController->>PostService: getPostsByCommunity(User, communityId)
  PostService->>PostRepository: findPostsByCommunity(User, communityId)
  alt Success
    Database-->>PostService: Posts
    PostService-->>PostController: <OK, Posts>
    PostController-->>User: Posts
  else Failure
    PostService-->>PostController: <ERR_CODE>
    PostController-->>User: <ERR_CODE, errorMessage>
  end
Loading

User Interactions

View User

sequenceDiagram
  actor User
  participant UserController
  participant UserService
  participant UserRepository
  participant Database

  User->>UserController: getUserById(userId)
  UserController->>UserService: getUserById(userId)
  UserService->>UserRepository: findUserById(userId)
  alt Success
    Database-->>UserService: User
    UserService-->>UserController: <OK, User>
    UserController-->>User: User
  else Failure
    UserService-->>UserController: <ERR_CODE>
    UserController-->>User: <ERR_CODE, errorMessage>
  end
Loading

Account

View Own Profile

sequenceDiagram
  actor User
  participant UserController
  participant UserService
  participant UserRepository
  participant Database

  User->>UserController: getUserById()
  UserController->>UserService: getUserById(userId)
  UserService->>UserRepository: findUserById(userId)
  alt Success
    Database-->>UserService: User
    UserService-->>UserController: <OK, User>
    UserController-->>User: User
  else Failure
    UserService-->>UserController: <ERR_CODE>
    UserController-->>User: <ERR_CODE, errorMessage>
  end
Loading

Edit Profile

sequenceDiagram
  actor User
  participant UserController
  participant UserService
  participant UserRepository
  participant Database

  User->>UserController: updateField(UpdateRequest)
  UserController->>UserService: updateField(User, UpdateRequest)
  UserService->>UserRepository: save(User)
  UserRepository-->>Database: User
  alt Success
    UserService-->>UserController: <OK, User>
    UserController-->>User: User
  else Failure
    UserService-->>UserController: <ERR_CODE>
    UserController-->>User: <ERR_CODE, errorMessage>
  end
Loading

Search

sequenceDiagram
  actor User
  participant PostController
  participant PostService
  participant WikidataService
  participant PostRepository
  participant Database

  User->>PostController: search(param)
  PostController->>PostService: searchPost(User, param)
  PostService->>PostRepository: findByText(param)
  PostService->>WikidataService: search(param)
  alt Success
    Database-->>PostService: Posts
    WikidataService-->>PostService: Results
    PostService-->>PostController: <OK, Posts, Results>
    PostController-->>User: Posts, Results
  else Failure
    PostService-->>PostController: <ERR_CODE>
    PostController-->>User: <ERR_CODE, errorMessage>
  end
Loading

Prepared By Oğuz Kağnıcı

🏠Home

Final Milestone Project Artifacts

🛠️Project

🔍Labs

📁Assignments

📝Meeting Notes

👥Team Members

📄Templates

⚽️352 Material

352 Material

🛠️Project

🔍Research

📁Assignments

📝Meeting Notes

👥Team Members

📄Templates

Clone this wiki locally