451 Sequence Diagrams - bounswe/bounswe2024group5 GitHub Wiki
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
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
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
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
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
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()
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
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