Skip to content

Sequence Diagrams

erenpakelgil edited this page Apr 30, 2024 · 9 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)
    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)
            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 Samuel Osayi
    Samuel Osayi->>Interface: << search for a query >>
    activate Interface
    Interface->>System: search(query)
    activate System
    System->>Wikidata API: apiRequest(query)
    activate Wikidata API
    Wikidata API -->> System: <status, responseObject>
    deactivate Wikidata API
    alt status IS 2xx
        activate System
        System-->>System: buildWikidataResult(responseObject)
        deactivate System
        System-->>Interface: WikidataResult 
        Interface-->>Samuel Osayi: << display search result>>   
    else
        System-->>Interface: errorResponse
        Interface-->>Samuel Osayi: << display search error>>
        deactivate System
    end
    deactivate Interface
Loading

4 - Create Post Sequence Diagram

sequenceDiagram
    actor Emma
    Emma->>Interface: <<creates a post >>
    activate Interface    
    Interface->>System: createNewPost(image,label_list,description)
    activate System
    System->>Database: createNewPost(user,image, label_list, description)
    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 - 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

6 - 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

7 - Like a Post Sequence Diagram

sequenceDiagram
    actor David
    David->>Interface: << Likes a post >>
    activate Interface
    Interface->>System: Like(post)
    activate System   
    System->>Database: incrementLike(post, username)
    activate Database
    Database-->>System: <status>
    deactivate Database
    alt status IS SUCCESS
        System-->>Database: addToLikedCollection(username,post)
        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

8 - 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,user,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

9 - 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, user)
    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

10 - 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

11 - Add Post to Collection Sequence Diagram

sequenceDiagram
    actor Hwang
    Hwang->>Interface: << attempts to add post to a collection >>
    activate Interface
    Interface->>System: addPostToCollection(post)
    activate System   
    System->>Database: insertPostToCollection(collectionId, post)
    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
Clone this wiki locally