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. Block User

sequenceDiagram
    actor User
    User->> Interface: <<Try to block a user>>
    activate Interface
    Interface ->>System: block(user)
    activate System
    System->>Database: insert_block(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 blocked you message>>
    deactivate System 
    Interface --)User: <<Display The user successfully blocked 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

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
    alt post with alert tag
    actor NotifiedUser
    Interface --)NotifiedUser: <<A post with an alert tag has been created message>>
    end
    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

2.6. Bookmark Post

sequenceDiagram
    actor User
    User->> Interface: <<Try to bookmark a post>>
    activate Interface
    Interface ->>System: bookmark(user,post)
    activate System
    System->>Database: insert_bookmark(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: << The post bookmarked post message>>
    deactivate System 
    Interface --)User: <<Display successful bookmark>>
    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)
    alt user searches another user
    System ->>Database: getProfile(userName)
    activate Database    
    alt error
    Database --)System: error
    System --)Interface: error
    Interface --)User: <<Show error message>>
    else successful
    Database --)System: success
    System --)Interface: success
    Interface --)User: <<Show user profile>>
    end
    else user searches an animal
    System ->>WikidataAPI: getAnimalData(animalName)
    activate WikidataAPI
    alt error
    WikidataAPI --)System: <<error>>
    System --)Interface: <<error>>
    Interface --)User: <<Show error message>>
    else success
    WikidataAPI --)System: <<Animal data>>
    deactivate WikidataAPI
    System ->>Database: getPostsOnAnimal(animal)
    Database --)System: <<Animal posts>>
    deactivate Database
    System --) Interface: <<Animal data and posts>>
    deactivate System
    Interface --) User: <<Show animal data and posts>>
    deactivate Interface
    end
    end 
Loading

Prepared by: Ali Bartu Konca 2021400177 Prepared by: Yasin ATLI 2020400246

⚠️ **GitHub.com Fallback** ⚠️