Skip to content

Sequence Diagrams

Onur Dilsiz edited this page Oct 15, 2024 · 16 revisions

1. User Authentication Processes

1.1 Register

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
Loading

1.2 Login

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
Loading

1.3 Logout

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
Loading

1.4 Edit Profile

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
Loading

1.5 Forget Password

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
Loading

2. Content Interaction

2.1 Creating a post

sequenceDiagram
    actor U as User
    participant S as System
    participant DB as Database

    %create_post
    U->>S: createPost()
    S->>DB: Check if  exists
    DB-->>S: * exists
    S->>DB: Check user privileges
    DB-->>S: Privileges confirmed
    S->>DB: Save post
    DB-->>S: Post saved
    S->>U: Post creation successful
Loading

2.2 Liking a post

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
Loading
Clone this wiki locally