-
Notifications
You must be signed in to change notification settings - Fork 0
Sequence Diagrams
Enestst edited this page Oct 21, 2024
·
16 revisions
sequenceDiagram
actor U as User
participant S as System
participant DB as Database
%register
U->>S: register(username, email, password)
S->>DB: Check if user exists
DB-->>S: User does not exist
S->>DB: Create new user
DB-->>S: User created
S->>U: Registration successful
sequenceDiagram
actor U as User
participant S as System
participant DB as Database
%login
U->>S: login(username, password)
S->>DB: Validate user credentials
DB-->>S: Credentials valid
S->>U: Login successful
sequenceDiagram
actor U as User
participant S as System
participant DB as Database
%logout
U->>S: logout()
S->>DB: Update user session
DB-->>S: Session updated
S->>U: Logout successful
sequenceDiagram
actor U as User
participant S as System
participant DB as Database
%edit_profile
U->>S: editProfile(username, email, password)
S->>DB: Retrieve user information
DB-->>S: User information retrieved
S->>DB: Update user information
DB-->>S: User information updated
S->>U: Profile edited successfully
sequenceDiagram
actor U as User
participant S as System
participant DB as Database
participant M as Mail Server
%forget_password
U->>S: forgetPassword(email)
S->>DB: Check if email exists
DB-->>S: Email found
S->>M: Send password reset link to email
M-->>U: Password reset link sent
Note over U: User clicks on the reset link
U->>S: resetPassword(newPassword, token)
S->>DB: Validate reset token
DB-->>S: Token valid
S->>DB: Update password
DB-->>S: Password updated
S->>U: Password reset successful
sequenceDiagram
actor U as User
participant S as System
participant DB as Database
%create_post
U->>S: createPost(content, images[], links[], tags[], id, Date)
S->>DB: Check user privileges
DB-->>S: Privileges confirmed
S->>DB: Save post
DB-->>S: Post saved
S->>U: Post creation successful
sequenceDiagram
actor U as User
participant S as System
participant DB as Database
%like_post
U->>S: likePost(postId)
S->>DB: Check if post exists
DB-->>S: Post exists
S->>DB: Check if user has already liked the post
DB-->>S: User has not liked the post
S->>DB: Register the like
DB-->>S: Like registered
S->>U: Post liked successfully
sequenceDiagram
participant RegisteredUser
participant BookmarkService
participant Post
RegisteredUser->>+BookmarkService: bookmarkPost(postId)
BookmarkService->>+Post: getPost(postId)
alt Post exists
Post-->>-BookmarkService: postDetails
BookmarkService->>+BookmarkService: addBookmark(userId, postId)
BookmarkService-->>-RegisteredUser: success
else Post does not exist
BookmarkService-->>-RegisteredUser: failure (Post not found)
end
sequenceDiagram
actor U as User
participant S as System
participant DB as Database
%follow_user
U->>S: followUser(targetUserId)
S->>DB: Check if target user exists
DB-->>S: Target user exists
S->>DB: Check if already following
DB-->>S: Not following
S->>DB: Save follow relationship
DB-->>S: Follow relationship saved
S->>U: Follow successful
sequenceDiagram
actor U as User
participant S as System
participant DB as Database
%unfollow_user
U->>S: unfollowUser(targetUserId)
S->>DB: Check if target user exists
DB-->>S: Target user exists
S->>DB: Check if currently following
DB-->>S: Following
S->>DB: Remove follow relationship
DB-->>S: Follow relationship removed
S->>U: Unfollow successful