451 Sequence Diagrams - bounswe/bounswe2024group5 GitHub Wiki

1. Create Quiz

sequenceDiagram
    actor AU as AuthenticatedUser
    participant QP as QuizPage
    participant QC as QuizController
    participant DB as Database

    AU->>+QP: createQuiz(quizData)
    QP->>+QC: createQuiz(quizDTO)
    QC->>+DB: save(quiz)
    
    alt Success
        DB-->>-QC: quizId
        QC-->>-QP: success
        QP-->>-AU: displaySuccess()
    else Error
        DB-->>QC: error
        QC-->>QP: error
        QP-->>AU: displayError(ERR_CODE, ERR_MESSAGE)
    end
Loading

2. Solve Quiz

sequenceDiagram
    actor U as User
    participant LP as ListingPage
    participant QP as QuizPage
    participant BE as Backend
    participant DB as Database

    U->>+LP: Select Quiz
    LP->>+BE: Get Quiz Details(quizId)
    BE->>+DB: Fetch Quiz
    DB-->>-BE: Quiz Data
    BE-->>-LP: Quiz Details
    LP->>+QP: Navigate to Quiz(quizDetails)

    loop For each question
        QP->>U: Display Question
        U->>QP: Select Answer
        QP->>QP: Evaluate Answer
        QP->>U: Show Result
        U->>QP: Next Question
    end

    QP->>U: Display Final Score
    QP->>+BE: Submit Quiz Results(score, answers)
    BE->>+DB: Save Quiz Results
    DB-->>-BE: Confirmation
    BE-->>-QP: Submission Confirmed
    QP->>U: Show Quiz Completion
Loading

3. Edit Quiz

sequenceDiagram
    actor AU as AuthenticatedUser
    participant QP as QuizPage
    participant QC as QuizController
    participant DB as Database

    AU->>+QP: editQuiz(quizId)
    QP->>+QC: getQuiz(quizId)
    QC->>+DB: fetchQuiz(quizId)
    DB-->>-QC: quizData
    QC-->>-QP: quiz
    QP-->>-AU: showEditForm()

    AU->>+QP: saveChanges(updatedQuiz)
    QP->>+QC: updateQuiz(updatedQuiz)
    QC->>+DB: update(quiz)
    
    alt Success
        DB-->>-QC: success
        QC-->>-QP: success
        QP-->>-AU: displaySuccess()
    else Error
        DB-->>QC: error
        QC-->>QP: error
        QP-->>AU: displayError(ERR_CODE, ERR_MESSAGE)
    end
Loading

4. Create a Forum Post

sequenceDiagram
    actor AU as AuthenticatedUser
    participant FP as ForumPage
    participant FC as ForumController
    participant DB as Database

    AU->>+FP: createPost(postData)
    FP->>+FC: createPost(postDTO)
    FC->>+DB: save(post)
    
    alt Success
        DB-->>-FC: postId
        FC-->>-FP: success
        FP-->>-AU: displaySuccess()
    else Error
        DB-->>FC: error
        FC-->>FP: error
        FP-->>AU: displayError(ERR_CODE, ERR_MESSAGE)
    end
Loading

5. Reply to a Forum Post

sequenceDiagram
    actor R as User
    R->>+ForumPage: click:choose a Post
    ForumPage->>+Post: viewPost
    Post->>+R: displayPost
    create participant replyToPost
    R->> replyToPost: write a Reply
    destroy replyToPost
    replyToPost-->> R: switch:PostPage
    R->>+Post: replyToAPost(post_id, reply)
    Post->>+ Database: addReply(content: Content, replier: UserId)
    alt Success
        Database-->>Post: <Reply added to Post>
        Post-->>R: Reply is added.
    else Failure
        Database-->>-Post: <ERR_CODE>
        Post-->>-R: displayError(ERR_CODE, ERR_MESSAGE)
    end
Loading

6. Search in Forum

sequenceDiagram
    actor U as User
    participant FP as ForumPage
    participant S as SearchEngine
    participant DB as Database
    participant LDS as LinkedDataSource

    U->>+FP: enterSearchQuery(query)
    FP->>+S: performSearch(query)
    S->>+DB: searchPosts(query)
    DB-->>-S: relatedPosts
    S->>+LDS: getLexvoData(query)
    LDS-->>-S: lexvoData
    S-->>-FP: searchResults(relatedPosts, lexvoData)
    FP-->>-U: displaySearchResults()

    U->>+FP: selectPost(postId)
    FP->>+DB: getPostDetails(postId)
    DB-->>-FP: postDetails
    FP-->>-U: displayPostDetails()
Loading

7. Login

sequenceDiagram
    actor GU as GuestUser
    participant LP as LoginPage
    participant AC as AuthController
    participant DB as Database

    GU->>+LP: login(credentials)
    LP->>+AC: authenticate(loginDTO)
    AC->>+DB: checkCredentials()
    
    alt Valid Credentials
        DB-->>-AC: success
        AC-->>-LP: success
        LP-->>-GU: redirectToHome()
    else Invalid Credentials
        DB-->>AC: error
        AC-->>LP: error
        LP-->>GU: displayError(ERR_CODE, ERR_MESSAGE)
    end
Loading

8. Register

sequenceDiagram
    actor GU as GuestUser
    participant RP as RegisterPage
    participant AC as AuthController
    participant DB as Database

    GU->>+RP: register(userData)
    RP->>+AC: register(userDTO)
    AC->>+DB: checkUserExists()
    
    alt User Does Not Exist
        DB-->>AC: false
        AC->>DB: createUser(userDTO)
        DB-->>-AC: success
        AC-->>-RP: success
        RP-->>-GU: redirectToLogin()
    else User Exists
        DB-->>AC: true
        AC-->>RP: error
        RP-->>GU: displayError(ERR_CODE, ERR_MESSAGE)
    end
Loading

Authors

Deniz, Ebrar, Fahreddin Özcan, Utku

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