Skip to content

UML Sequence Diagrams

Hanaa Zaqout edited this page Oct 25, 2024 · 6 revisions

1 - Login Sequence Diagram

sequenceDiagram
    actor Susanne
    Susanne->>Interface: << Enters login information >>
    activate Interface
    Interface->>System: login(username, password)
    activate System   
    System->>Database: verifyLoginInformation(username, password)
    activate Database
    Database-->>System: <status>
    deactivate Database
    alt status IS 200
        System-->>Interface: successResponse << authorize user >>
        Interface->>Susanne: << redirect to homepage >>
    else
        System-->>Interface: errorResponse << wrong login information >>
        deactivate System
        Interface->>Susanne: << display login error >>
    end    
    deactivate Interface
Loading

2 - Register Sequence Diagram

sequenceDiagram
    actor Joseph
    Joseph->>Interface: << enters registration information >>
    activate Interface    
    Interface->>System: register(username, email, password, user_type)
    activate System
    System->>Database: verifyRegistrationConditions(username, email, password)
    activate Database
    Database-->>System: <status1>
    deactivate Database  
        alt status1 IS SUCCESS            
            System->>Database: createUser(username, email, password, user_type)
            activate Database
            Database-->>System: <status2>
            deactivate Database
                alt status2 IS 201
                    System-->>Interface: successResponse << user created >>
                    Interface-->>Joseph: << display success message and redirect to login page>>
                else
                    System-->>Interface: errorResponse << failure while creating user >>
                    Interface-->>Joseph: << display registeration error >>
                end
        else
            System-->>Interface: errorResponse << registration conditions not met >>
            deactivate System
            Interface-->>Joseph: << display registeration error >>
        end
    deactivate Interface
Loading

3 - Search Sequence Diagram

sequenceDiagram
    actor Hussein
    Hussein->>Interface: << searches for fitness material >>
    activate Interface
    Interface->>System: search(query)
    activate System

    alt query is "exercise type"
        System->>Database: searchExerciseByName(query)
        activate Database
        Database-->>System: <status, exercisePage>
        deactivate Database
        System-->>Interface: exercisePage << display exercise page >>
    else query is "nutrition"
        System->>Database: searchNutritionByName(query)
        activate Database
        Database-->>System: <status, nutritionPage>
        deactivate Database
        System-->>Interface: nutritionPage << display nutrition page >>
    else query is "muscle"
        System->>Database: searchMuscleByName(query)
        activate Database
        Database-->>System: <status, muscleInfoList>
        deactivate Database
        System-->>Interface: muscleInfoList << display muscle information list >>
    end

    Interface-->>Hussein: << display search results >>

    deactivate System
    deactivate Interface

Loading

4 - Create Post Sequence Diagram

sequenceDiagram
    actor Emma
    Emma->>Interface: <<creates a post >>
    activate Interface    
    Interface->>System: createNewPost(owner,title,image,label_list,description,uri_list)
    activate System
    System->>Database: createNewPost(owner,title,image,label_list,description,uri_list)
    activate Database
    Database-->>System: <status1>
    deactivate Database  
    alt status1 IS SUCCESS
        System-->>Interface: successResponse << comment created >>
        Interface-->>Emma: << display success message >>
        else
            System-->>Interface: errorResponse
            deactivate System
            Interface-->>Emma: << display unable to create post error >>
        end
    deactivate Interface
Loading

5 - Create Diet Sequence Program

sequenceDiagram
    actor Charles
    Charles->>Interface: <<creates a diet program >>
    activate Interface    
    Interface->>System: createNewDietProgram(dietician_name,program_name,title,list_of_nutrition,description,total_calories)
    activate System
    System->>Database: createDietProgram(owner_id,program_name,title,list_of_nutrition, description, total_calories)
    activate Database
    Database-->>System: <status1>
    deactivate Database  
    alt status1 IS SUCCESS
        System-->>Interface: successResponse << program created >>
        Interface-->>Charles: << display success message >>
        else
            System-->>Interface: errorResponse
            deactivate System
            Interface-->>Charles: << display unable to create program error >>
        end
    deactivate Interface
Loading

6 - Create Training Sequence Program

sequenceDiagram
    actor Duvan
    Duvan->>Interface: <<creates a training program >>
    activate Interface    
    Interface->>System: createNewTrainingProgram(trainer_name,title,list_of_exercises,description,training_type,name)
    activate System
    System->>Database: createTrainingProgram(owner_id,program_name,title,list_of_exercises,description,training_type,name)
    activate Database
    Database-->>System: <status1>
    deactivate Database  
    alt status1 IS SUCCESS
        System-->>Interface: successResponse << program created >>
        Interface-->>Duvan: << display success message >>
        else
            System-->>Interface: errorResponse
            deactivate System
            Interface-->>Duvan: << display unable to create program error >>
        end
    deactivate Interface
Loading

7 - Viewing Own Profile Sequence Diagram

sequenceDiagram
    actor John Doe
    John Doe->>Interface: <<clicks on own profile image>>
    activate Interface    
    Interface->>System: view(profile_id)
    activate System
    System->>Database: search(profile_id)
    activate Database
    Database-->>System: <status1>, responseObj
    deactivate Database  
    alt status1 IS SUCCESS
        System-->>Interface: responseObj <<database query results>>
        Interface-->>John Doe: << display profile >>
        else
            System-->>Interface: errorResponse
            deactivate System
            Interface-->>John Doe: << display unable to view profile error >>
        end
    deactivate Interface

Loading

8 - Send Notification as an Admin Sequence Diagram

sequenceDiagram
    actor Frederick
    Frederick->>Interface: << enters notification content >>
    activate Interface    
    Interface->>System: sendNotification(notification)
    activate System
    actor Users    
    System-->>Interface: status
        alt status IS SUCCESS  
            System-->>Interface: << sends the notification >> 
            deactivate System
            Interface-->>Users: << display notification >>         
            Interface-->>Frederick: << display success message >>
        else
            Interface-->>Frederick: << display error message >>
        end
    deactivate Interface
Loading

9 - Like a Post Sequence Diagram

sequenceDiagram
    actor David
    David->>Interface: << Likes a post >>
    activate Interface
    Interface->>System: Like(post_id)
    activate System   
    System->>Database: incrementLike(post_id, username)
    activate Database
    Database-->>System: <status>
    deactivate Database
    alt status IS SUCCESS
        System-->>Database: addToLikedCollection(username,post_id)
        System-->>Interface: successResponse << post liked >>
        Interface-->>David: << display success message >>
        actor John
        Interface-->>John: << display liked notification >>
    else
        System-->>Interface: errorResponse
        deactivate System
        Interface-->>David: << display like error >>
    end    
    deactivate Interface
Loading

10 - Add Comment To Post Sequence Diagram

sequenceDiagram
    actor David
    David->>Interface: << Enters comment to a user post >>
    activate Interface
    Interface->>System: createComment(content)
    activate System   
    System->>Database: createComment(post_id,username,content)
    activate Database
    Database-->>System: <status>
    deactivate Database
    alt status IS SUCCESS
        System-->>Interface: successResponse << comment created >>
        Interface-->>David: << display success message >>
        actor John
        Interface-->>John: << display notification >>
    else
        System-->>Interface: errorResponse
        deactivate System
        Interface-->>David: << display comment creation error >>
    end    
    deactivate Interface

Loading

11 - Create New Collection Sequence Diagram

sequenceDiagram
    actor Farouq
    Farouq->>Interface: << attempts to create a collection >>
    activate Interface
    Interface->>System: createCollection(name)
    activate System   
    System->>Database: createCollection(name, username)
    activate Database
    Database-->>System: <status>
    deactivate Database
    alt status IS SUCCESS
        System-->>Interface: successResponse << collection created >>
        Interface->>Farouq: << display success message >>
    else
        System-->>Interface: errorResponse
        deactivate System
        Interface->>Farouq: << display collection creation error >>
    end    
    deactivate Interface
Loading

12 - Access the Admin Panel as an Admin

sequenceDiagram
    actor Victor
    Victor->>Interface: << attempts to open the admin panel >>
    activate Interface    
    Interface->>Database: << check for the relevant information >>
    activate Database   
    Database-->>Interface: status
        alt status IS SUCCESS  
            Database-->>Interface: successResponse << panel ready >>
            Interface-->>Victor: << display the admin panel >>
            
        else
            Database-->>Interface: errorResponse << panel conditions not met >>
            deactivate Database
            Interface-->>Victor: << display error message >>
        end
    deactivate Interface
Loading

13 - Add Post to Collection Sequence Diagram

sequenceDiagram
    actor Hwang
    Hwang->>Interface: << attempts to add post to a collection >>
    activate Interface
    Interface->>System: addPostToCollection(post_id)
    activate System   
    System->>Database: insertPostToCollection(collectionId, post_id)
    activate Database
    Database-->>System: <status>
    deactivate Database
    alt status IS SUCCESS
        System-->>Interface: successResponse << post added to collection >>
        Interface-->>Hwang: << display success message >>
    else
        System-->>Interface: errorResponse
        deactivate System
        Interface-->>Hwang: << display error message>>
    end    
    deactivate Interface
Loading

14 - Join Diet Program Sequence Diagram

sequenceDiagram
actor Zeynap
    Zeynap->>Interface: << joins a diet program >>
    activate Interface    
    Interface->>System: joinDietProgram(diet_program_id, profile_id)
    activate System
    System->>Database: insertProfileToDietProgram(diet_program_id, profile_id)
    activate Database
    Database-->>System: <status>
    deactivate Database  
    
    alt status IS SUCCESS
        System-->>Interface: successResponse << joined the diet program successfully >>
        Interface-->>Zeynap: << display success message >>
        Interface->>ProfilePage: << update diet program list >>
    else
        System-->>Interface: errorResponse << unable to join the diet program >>
        Interface-->>Zeynap: << display error message >>
    end
    deactivate System
    deactivate Interface
Loading

15 - Join Training Program Sequence Diagram

sequenceDiagram
    actor Ali
    Ali->>Interface: << joins a training program >>
    activate Interface    
    Interface->>System: joinTrainingProgram(training_program_id, profile_id)
    activate System
    System->>Database: insertProfileToTrainingProgram(training_program_id, profile_id)
    activate Database
    Database-->>System: <status>
    deactivate Database  
    
    alt status IS SUCCESS
        System-->>Interface: successResponse << joined the training program successfully >>
        Interface-->>Ali: << display success message >>
        Interface->>ProfilePage: << update training program list >>
    else
        System-->>Interface: errorResponse << unable to join the training program >>
        Interface-->>Ali: << display error message >>
    end
    deactivate System
    deactivate Interface
Loading

16 - Submit Daily Progress to Leaderboard Sequence Diagram

sequenceDiagram
    actor Dina
    Dina->>Interface: << submits daily progress >>
    activate Interface
    Interface->>System: submitProgress(training_program_id, time_duration, checklist)
    activate System
    System->>Database: registerDailyProgress(user_id, training_program_id, time_duration, checklist)
    activate Database
    Database-->>System: <status, updated_points, updated_streak>
    deactivate Database
    
    alt status IS SUCCESS
        System-->>Interface: successResponse << progress submitted >>
        Interface->>System: updateLeaderboard(user_id, updated_points, updated_streak)
        activate System
        System->>Database: updateLeaderboardEntry(user_id, updated_points, updated_streak)
        deactivate System
        Interface-->>Dina: << display updated leaderboard >>
    else status IS FAILURE
        System-->>Interface: errorResponse << submission failed >>
        Interface-->>Dina: << display submission error >>
    end
    
    deactivate System
    deactivate Interface

Loading
Clone this wiki locally