Tradeverse Sequence Diagrams - bounswe/bounswe2024group10 GitHub Wiki

1. Account

1.1. Registeration

sequenceDiagram
    actor User
    User->> Interface: <<Enters registeration information>>
    activate Interface
    Interface ->>System: register(userName,eMail,password)
    activate System
    System->>Database: isValidRegister(userName,eMail, password)
    activate Database
    alt userName/eMail is used
    Database --)System: failure
    System --)Interface: failure
    Interface --)User: <<Display error message>>
    else credentials are available
    Database --)System: success
    deactivate Database
    System --)Interface: success
    deactivate System
    Interface --)User: <<Display successful registration message>>
    deactivate Interface
    
    end
Loading

1.2. Login

sequenceDiagram
    actor User
    User->> Interface: <<Enters login information>>
    activate Interface
    Interface ->>System: login(userName,password)
    activate System
    System->>Database: isValidLogin(userName,password)
    activate Database
    alt wrong username/password
    Database --)System: failure
    System --)Interface: failure
    Interface --)User: <<Display error message>>
    else username password match
    Database --)System: success
    deactivate Database
    System --)Interface: success
    deactivate System
    Interface --)User: <<Display successful login message>>
    deactivate Interface
    
    end
Loading

1.3. Follow User

sequenceDiagram
    actor User
    User->> Interface: <<Try to follow a user>>
    activate Interface
    Interface ->>System: follow(user)
    activate System
    System->>Database: insert_follow(userID, userID)
    activate Database
    alt error
    Database --)System: failure
    System --)Interface: failure
    Interface --)User: <<Display error while following message>>
    else successful
    Database --)System: success
    deactivate Database
    System --)Interface: success
    actor NotifiedUser
    Interface --)NotifiedUser: <<A user has started following you message>>
    deactivate System 
    Interface --)User: <<Display successful follow message>>
    deactivate Interface
    
    end
Loading

1.4. Unfollow User

sequenceDiagram
    actor User
    User->> Interface: <<Try to unfollow a user>>
    activate Interface
    Interface ->>System: unfollow(user)
    activate System
    System->>Database: insert_unfollow(userID,userID)
    activate Database
    alt error
    Database --)System: failure
    System --)Interface: failure
    Interface --)User: <<Display error message>>
    else successful
    Database --)System: success
    deactivate Database
    System --)Interface: success
    deactivate System 
    Interface --)User: <<Display successful unfollow message>>
    deactivate Interface
    end
Loading

1.5. Ban User (by Admin)

sequenceDiagram
    actor User
    User->> Interface: <<Try to ban a user>>
    activate Interface
    Interface ->>System: ban(user)
    activate System
    System->>Database: insert_ban(userID, userID)
    activate Database
    alt error
    Database --)System: failure
    System --)Interface: failure
    Interface --)User: <<Display error while following message>>
    else successful
    Database --)System: success
    deactivate Database
    System --)Interface: success
    actor NotifiedUser
    Interface --)NotifiedUser: <<The user is banned you message>>
    deactivate System 
    Interface --)User: <<Display The user successfully banned message>>
    deactivate Interface
    
    end
Loading

1.6. View Profile

sequenceDiagram
    actor User
    User->> Interface: <<Try to view a profile>>
    activate Interface
    Interface ->>System: getProfile(user)
    activate System
    System->>Database: getProfile(userID)
    activate Database
    alt error
    Database --)System: failure
    System --)Interface: failure
    Interface --)User: <<Display error message>>
    else successful
    Database --)System: <<Profile Data>>
    deactivate Database
    System --)Interface: <<Profile Data>>
    deactivate System 
    Interface --)User: <<Display profile>>
    deactivate Interface
    end
Loading

1.7 View own profile

sequenceDiagram
    actor User
    User ->> Interface: <<Select new<br>profile picture>>
    activate Interface
    Interface ->> System: <<Upload<br>profile picture>>
    activate System
    System ->> Database: updateProfilePicture(userID, newPicture)
    activate Database
    alt successful
        Database --) System: <<Profile picture<br>updated successfully>>
        System --) Interface: <<Success>>
        Interface --) User: <<Profile picture<br>updated successfully>>
    else error
        Database --) System: <<Error occurred>>
        System --) Interface: <<Error>>
        Interface --) User: <<Failed to update<br>profile picture>>
    end
Loading

1.8. Unban User (by Admin)

sequenceDiagram
    actor User
    User->> Interface: <<Try to unban a user>>
    activate Interface
    Interface ->>System: unban(user)
    activate System
    System->>Database: insert_unban(userID, userID)
    activate Database
    alt error
    Database --)System: failure
    System --)Interface: failure
    Interface --)User: <<Display error while following message>>
    else successful
    Database --)System: success
    deactivate Database
    System --)Interface: success
    actor NotifiedUser
    Interface --)NotifiedUser: <<The user is unbanned you message>>
    deactivate System 
    Interface --)User: <<Display The user successfully unbanned message>>
    deactivate Interface
    
    end
Loading

1.9. Create Portfolio

sequenceDiagram
    actor User
    User ->>Interface: <<Create portfolio request>>
    activate Interface
    Interface ->> System: createPortfolio(AssetList)
    activate System
    System ->> Database: addPortfolio(AssetList)
    activate Database
    alt successful
    Database --)System: success
    System --)Interface: success
    Interface --)User: <<Display successful portfolio creation message>>
    else error
    Database --)System: failure
    deactivate Database
    System --)Interface: failure
    deactivate System
    Interface --)User: <<Display unsuccessful portfolio creation message>>
    deactivate Interface
    end
Loading

1.10 User Tag

sequenceDiagram
    actor User
    User ->> Interface: <<Select tag or Update tag>>
    activate Interface
    Interface ->> System: selectTagRequest(tagId)
    activate System
    alt action is "SelectTag"
        System ->> Database: selectTag(tagId)
        activate Database
        alt successful
            Database --) System: <<Tag selected successfully>>
            System --) Interface: <<Success>>
            Interface --) User: <<Updated Profile Data>>
        else error
            Database --) System: <<Error occurred>>
            System --) Interface: <<Error>>
            Interface --) User: <<Failed to select tag>>
        end
    else action is "UpdateTag"
        System ->> Database: updateUserTag(tagId)
        activate Database
        alt successful
            Database --) System: <<Tag updated successfully>>
            System --) Interface: <<Success>>
            Interface --) User: <<Tag updated successfully>>
        else error
            Database --) System: <<Error occurred>>
            System --) Interface: <<Error>>
            Interface --) User: <<Failed to update tag>>
        end
    end
Loading

2. Post

2.1. Create Post

sequenceDiagram
    actor User
    User ->>Interface: <<Create post request>>
    activate Interface
    Interface ->> System: createPost(post)
    activate System
    System ->> Database: addPost(postID,location,tags,animalName,pictureDate,postDate,userID)
    activate Database
    alt successful
    Database --)System: success
    System --)Interface: success
    actor NotifiedUser
    Interface --)User: <<Display successful post creation message>>
    else error
    Database --)System: failure
    deactivate Database
    System --)Interface: failure
    deactivate System
    Interface --)User: <<Display unsuccessful post creation message>>
    deactivate Interface
    end
Loading

2.2. View Post

sequenceDiagram
    actor User
    User ->>Interface: <<View post request>>
    activate Interface
    Interface ->> System: getPost(post)
    activate System
    System ->> Database: getPost(postID)
    activate Database
    alt successful
    Database --)System: <<Post Data>>
    System --)Interface: <<Post Data>>
    Interface --)User: <<Display the post>>
    else error
    Database --)System: failure
    deactivate Database
    System --)Interface: failure
    deactivate System
    Interface --)User: <<Display error message>>
    deactivate Interface
    end
Loading

2.3. Like Post

sequenceDiagram
    actor User
    User->> Interface: <<Try to like a post>>
    activate Interface
    Interface ->>System: like(user,post)
    activate System
    System->>Database: insert_like(userID,postID)
    activate Database
    alt error
    Database --)System: failure
    System --)Interface: failure
    Interface --)User: <<Display error message>>
    else successful
    Database --)System: success
    deactivate Database
    System --)Interface: success
    actor owner
    Interface --)owner: <<A user has liked your post message>>
    deactivate System 
    Interface --)User: <<Display successful like>>
    deactivate Interface
    end
Loading

2.4. Dislike Post

sequenceDiagram
    actor User
    User->> Interface: <<Try to dislike a post>>
    activate Interface
    Interface ->>System: dislike(user,post)
    activate System
    System->>Database: insert_dislike(userID,postID)
    activate Database
    alt error
    Database --)System: failure
    System --)Interface: failure
    Interface --)User: <<Display error message>>
    else successful
    Database --)System: success
    deactivate Database
    System --)Interface: success
    actor owner
    Interface --)owner: <<A user has disliked your post message>>
    deactivate System 
    Interface --)User: <<Display successful dislike>>
    deactivate Interface
    end
Loading

2.5. Comment On Post

sequenceDiagram
    actor User
    User->> Interface: <<Try to comment on a post>>
    activate Interface
    Interface ->>System: comment(post,comment)
    activate System
    System->>Database: insert_comment(userID,postID,comment)
    activate Database
    alt error
    Database --)System: failure
    System --)Interface: failure
    Interface --)User: <<Display error message>>
    else successful
    Database --)System: success
    deactivate Database
    System --)Interface: success
    actor owner
    Interface --)owner: <<A user has commented on your post message>>
    deactivate System 
    Interface --)User: <<Display successful comment>>
    deactivate Interface
    end
Loading

3. Search

3.1. Search

sequenceDiagram
    actor User
    User ->> Interface: <<Type to search bar>>
    activate Interface
    Interface ->> System: query(input)
    activate System
    System ->> System: determineQuery(input)

    %% Single query for multiple results %%
    System ->> Database: searchAll(input)
    activate Database
    alt error
        Database --) System: error
        System --) Interface: <<error>>
        Interface --) User: <<Show error message>>
    else success
        Database --) System: <<usernames, posts, tags>>
        deactivate Database
        
        %% Process and show results %%
        System --) Interface: <<Results (usernames, posts, tags)>>
        deactivate System
        Interface --) User: <<Show search results (usernames, posts, tags)>>
        deactivate Interface
    end
Loading

4. Subforum

4.1. Create Subforum (by Admin)

sequenceDiagram
    actor User
    User ->> Interface: <<Create subforum request>>
    activate Interface
    Interface ->> System: createSubforum (subforum)
    activate System
    System ->> Database: addSubForum(base_tag, subforumName, pictureDate, postDate, userID)
    activate Database
    alt successful
    Database --) System: success
    System --) Interface: success
    Interface --) User: <<Display successful subforum creation message>>
    
    %% Notification to the admin %%
    System ->> NotifiedAdmin: <<Notify admin of new subforum creation>>

    else error
    Database --) System: failure
    deactivate Database
    System --) Interface: failure
    deactivate System
    Interface --) User: <<Display unsuccessful subforum creation message>>
    deactivate Interface
    end
Loading

4.2. View Subforum

sequenceDiagram
    actor User
    User ->>Interface: <<View subforum request>>
    activate Interface
    Interface ->> System: getSubforum(subforumId)
    activate System
    System ->> Database: getSubforum(subforumId)
    activate Database
    alt successful
    Database --)System: <<Subforum Data>>
    System --)Interface: <<Subforum Data>>
    Interface --)User: <<Display the subforum>>
    else error
    Database --)System: failure
    deactivate Database
    System --)Interface: failure
    deactivate System
    Interface --)User: <<Display error message>>
    deactivate Interface
    end
Loading

4.3. Follow Subforum

sequenceDiagram
    actor User
    User->> Interface: <<Try to follow a subforum>>
    activate Interface
    Interface ->>System: follow(subforum)
    activate System
    System->>Database: insert_subforum(userID, userID)
    activate Database
    alt error
    Database --)System: failure
    System --)Interface: failure
    Interface --)User: <<Display error while following message>>
    else successful
    Database --)System: success
    deactivate Database
    System --)Interface: success
    deactivate System 
    Interface --)User: <<Display successful follow message>>
    deactivate Interface
    
    end
Loading
  • Prepared by: Gülşen Sabak 2020400072
  • Prepared by: Hüseyin Karataş 2020400021
  • Prepared by: Yusuf Kağan Çiçekdağ 2021400240
⚠️ **GitHub.com Fallback** ⚠️