Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Controllers for course #4

Open
Musoye opened this issue Oct 18, 2023 · 3 comments
Open

Create Controllers for course #4

Musoye opened this issue Oct 18, 2023 · 3 comments

Comments

@Musoye
Copy link
Collaborator

Musoye commented Oct 18, 2023

create course controller

The file should be under controller/course.js

The schema contain - course_id, title, description, user_id(instructor)

  • create a function createCourss that creates a new course
    This function will accept the request object. The title and user_id must be present. If user_id not a user return 404 with error no user found else return the missing object with status code 400. If everything is okay, Create the new course with new id(course_id) and return status code 201 with new object created.

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

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

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

  • create a function deleteCourse that get a course with a particular ID. The ID will be part of the url(Paramus). If course not found return 404 with error course not found. IF okay Then delete this course and return 200 with details of course deleted

POST - createCourse, updateCourse
GET - getCourses, getCourse, deleteCourse

routes

/courses - createCourse, getCourses
/courses/:course_id - getCourse, deleteCourse, updateCourse

Import this into and create the routes in routes/course.js then include it in server.js. Test everything if possible. Write an automated testing for testing each endpoints in course_test.py/.js

@Arun-cn
Copy link
Contributor

Arun-cn commented Oct 18, 2023

can i work on this issue?

@vihar-s1
Copy link
Contributor

I would like to work on this issue!

@vihar-s1
Copy link
Contributor

vihar-s1 commented Oct 25, 2023

@Musoye please assign this issue to me instead of issue #6 as that issue depends on this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants