This pull request refactors the quiz management functionality to separate user and classroom quizzes, implements new components for handling and rendering quizzes, and integrates classroom-specific validation and state management.
Changes
State Management
Separated initialState into user and class quizzes in quizSlice.js.
Refactored getQuizzes thunk into getUserQuizzes to fetch user quizzes and updated state handling.
Implemented getClassQuizzes thunk for fetching class quizzes and added corresponding state handling cases.
Refactored function names to match changes in quizService.js.
Component Updates
Moved state management from Quizzes.jsx to a new component UserQuizList.jsx.
Implemented ClassQuizList.jsx to handle client-side logic, state management, and quiz rendering.
Integrated UserQuizList.jsx and ClassQuizList.jsx into Quizzes.jsx.
Schema and Model Enhancements
Defined a classroom schema with required fields and created a Classroom model.
Separated scoreSchema into a new module and added a new classroom field to quizSchema.
Implemented quizScoreSchema and integrated it into userSchema, including a classroom reference in the Classroom model.
Integrated input validation, user and classroom ID matching into the createQuiz function.
API and Backend Enhancements
Implemented a new function getQuizzesByClassroom to fetch quizzes based on user and quiz ID, and classroom enrollment.
Integrated getQuizzesByClassroom into a new API endpoint in quizRoutes.js.
Component and State Integration
Implemented Classroom.jsx to manage and render classroom quizzes.
Integrated redux state handling, input field validation, and new HTML input elements to reflect classroom schema addition in QuizForm.jsx.
Integrated the Classroom component into Dashboard.jsx.
Testing
Verified the separation of initialState into user and class quizzes.
Confirmed the refactoring of getQuizzes to getUserQuizzes and state handling updates.
Tested the implementation of getClassQuizzes thunk for fetching class quizzes and state handling.
Validated the refactoring of function names in quizService.js.
Tested the new UserQuizList.jsx component for state management.
Confirmed the implementation and integration of ClassQuizList.jsx.
Verified the definition of classroom schema and creation of the Classroom model.
Tested the integration of scoreSchema and the addition of the classroom field to quizSchema.
Verified the integration of quizScoreSchema into userSchema.
Tested input validation and ID matching in the createQuiz function.
Confirmed the implementation of getQuizzesByClassroom and its integration into the API endpoint.
Verified the implementation and functionality of Classroom.jsx.
Tested the integration of redux state handling and input validation in QuizForm.jsx.
Confirmed the integration of the Classroom component into Dashboard.jsx.
Additional Information
These changes enhance the quiz management functionality by separating user and classroom quizzes, improving component structure, and integrating robust validation and state management.
Summary
This pull request refactors the quiz management functionality to separate user and classroom quizzes, implements new components for handling and rendering quizzes, and integrates classroom-specific validation and state management.
Changes
State Management
initialState
into user and class quizzes inquizSlice.js
.getQuizzes
thunk intogetUserQuizzes
to fetch user quizzes and updated state handling.getClassQuizzes
thunk for fetching class quizzes and added corresponding state handling cases.quizService.js
.Component Updates
Quizzes.jsx
to a new componentUserQuizList.jsx
.ClassQuizList.jsx
to handle client-side logic, state management, and quiz rendering.UserQuizList.jsx
andClassQuizList.jsx
intoQuizzes.jsx
.Schema and Model Enhancements
Classroom
model.scoreSchema
into a new module and added a newclassroom
field toquizSchema
.quizScoreSchema
and integrated it intouserSchema
, including aclassroom
reference in theClassroom
model.createQuiz
function.API and Backend Enhancements
getQuizzesByClassroom
to fetch quizzes based on user and quiz ID, and classroom enrollment.getQuizzesByClassroom
into a new API endpoint inquizRoutes.js
.Component and State Integration
Classroom.jsx
to manage and render classroom quizzes.QuizForm.jsx
.Classroom
component intoDashboard.jsx
.Testing
initialState
into user and class quizzes.getQuizzes
togetUserQuizzes
and state handling updates.getClassQuizzes
thunk for fetching class quizzes and state handling.quizService.js
.UserQuizList.jsx
component for state management.ClassQuizList.jsx
.Classroom
model.scoreSchema
and the addition of theclassroom
field toquizSchema
.quizScoreSchema
intouserSchema
.createQuiz
function.getQuizzesByClassroom
and its integration into the API endpoint.Classroom.jsx
.QuizForm.jsx
.Classroom
component intoDashboard.jsx
.Additional Information