Sequence Diagrams - bounswe/bounswe2024group11 GitHub Wiki

Viewset To Database

This is a generic sequence. Other models follows this.

sequenceDiagram
    Viewset->>+Controller: create(RequestObject)
    Controller->>+Serializer: create(RequestObject)
    Serializer->>+Model: create(SerialObject)
    Model->>+Database: create(ModelObject)
    alt saving is successful
    Database-->>Model: success
    Model-->>Serializer: success
    Serializer-->>Controller: success
    Controller-->>Viewset: success
    else
    Database-->>Model: failure
    Model-->>Serializer: failure
    Serializer-->>Viewset: failure
    Controller-->>Viewset: failure
    end

Create Quiz

sequenceDiagram
    loop For each Quiz Question
    loop For question word for each question choice
    Registered User->>+BabelNetClient: fetch_synsets(keyword)
    BabelNetClient->>+BabelNetAPI:get_synsets(keyword, api_key)
    BabelNetAPI-->>BabelNetClient: translation list
    BabelNetClient-->>Registered User: translation list
    end
    end
    Registered User->>+QuizViewset: create(QuizQuestion)
    alt saving is successful
    QuizViewset-->>Registered User: success
    else
    QuizViewset-->>Registered User: failure
    end

Take Quiz

sequenceDiagram

Registered User ->>+ QuizViewSet: question_list()
loop For Each Quiz Question
    QuizViewSet ->> QuizQuestionViewSet : 
    QuizQuestionViewSet -->> QuizViewSet : Quiz Question
    QuizViewSet -->> Registered User : Quiz Question
    Registered User ->>+ QuizViewSet : Answer
    QuizViewSet ->>+ QuizQuestionViewSet : Answer
    alt
        QuizQuestionViewSet -->> QuizViewSet : success
        else
        QuizQuestionViewSet -->> QuizViewSet : failure
    end
end

Create Forum Question

sequenceDiagram
    Registered User->>+BabelNetClient: fetch_synsets(keyword)
    BabelNetClient->>+BabelNetAPI:get_synsets(keyword, api_key)
    BabelNetAPI-->>BabelNetClient: entity list
    BabelNetClient-->>Registered User: entity list
    Registered User->>+ForumQuestionViewset: create(ForumQuestion)
    alt 
    ForumQuestionViewset-->>Registered User: success
    else
    ForumQuestionViewset-->>Registered User: failure
    end

Semantic Search for Forum

sequenceDiagram

    Registered User->>+BabelNetClient: fetch_synsets(keyword)
    BabelNetClient->>+BabelNetAPI:get_synsets(keyword, api_key)
    BabelNetAPI-->>BabelNetClient: entity list
    BabelNetClient-->>Registered User: entity list
    Registered User->>+ForumQuestionFeedViewset: get(entityId)
    
    alt 
    ForumQuestionFeedViewset-->>Registered User: success
    else
    ForumQuestionFeedViewset-->>Registered User: failure
    end

Question Bookmark for Forum

sequenceDiagram
    Registered User->>+ForumQuestionBookmarkViewset: bookmark_question(questionId)
    alt 
    ForumQuestionBookmarkViewset-->>Registered User: success
    else
    ForumQuestionBookmarkViewset-->>Registered User: failure
    end

Semantic Search for Quiz

sequenceDiagram

    Registered User->>+BabelNetClient: fetch_synsets(keyword)
    BabelNetClient->>+BabelNetAPI:get_synsets(keyword, api_key)
    BabelNetAPI-->>BabelNetClient: entity list
    BabelNetClient-->>Registered User: entity list
    Registered User->>+QuizFeedViewset: get(entityId)
    
    alt 
    QuizFeedViewset-->>Registered User: success
    else
    QuizFeedViewset-->>Registered User: failure
    end

Block User

sequenceDiagram
    Registered User->>+UserInfoViewset: getUser(username)
    alt 
    UserInfoViewset-->>Registered User: success
    else
    UserInfoViewset-->>Registered User: failure
    end
    Registered User->>+BlockViewset: blockUser(username)
    alt 
    BlockViewset-->>Registered User: success
    else
    BlockViewset-->>Registered User: failure
    end

Follow User

sequenceDiagram
    Registered User->>+UserInfoViewset: getUser(username)
    alt 
    UserInfoViewset-->>Registered User: success
    else
    UserInfoViewset-->>Registered User: failure
    end
    Registered User->>+FollowViewset: followUser(username)
    alt 
    FollowViewset-->>Registered User: success
    else
    FollowViewset-->>Registered User: failure
    end