devvspaces/EduHub

create assessment/assignment collection

Opened this issue · 0 comments

Musoye commented

create assessment controller

The file should be under controller/assessment.js

The schema contain - assessment_id, course_id, title, description, type(test, exam, assignment)

  • create a function createAssessment that creates a new assessment
    This function will accept the request object and every rows must be
    Present else return the missing object with status code 400. If everything is okay, Create the new assessment with new id(assessment_id) and return status code 201 with new object created.

  • create a function getAssessments that get all assessments in the database. return status code 200 with all the assessments.

  • create a function getAssessment that get an assessment with a particular ID. The ID will be part of the url(params). If assessment not found return 404 with error assessment not found. If okay, return the assessment with 200 statuscode

  • create a function updateAssessment that get a assement with a particular ID. The ID will be part of the url(params). If assessment not found return 404 with error assessment not found. If found take the request object and update it accordingly and return the new record with status code 200

  • create a function deleteAssessment that get an assessment with a particular ID. The ID will be part of the url(params). If user not found return 404 with error assesssment not found. Then delete this user and return 200 with details of assessment deleted

POST - createAssessment, updateAssessment
GET - getAssessments, getAssessment , deleteAssessment

routes

/assessments -> creatUser, getUsers
/assessments/:assessment_id -> getUser, deleteUser, updateUser

Import this into and include the routes in routes/assessment.js then include it in sever.js.
Test everything if possible.(Optional: Write an automated testing for testing each endpoints in assessment_test.py/.js)