Module

CourseSection Controller

This module is responsible for handling all course section related requests

The following routes are handled by this module::


POST /coursesection/new
GET /coursesection/:id
PATCH /coursesection/update/:id
DELETE /coursesection/delete/:id

View Source API/src/controllers/coursesection.controllers.js, line 1

Requires

  • module:../models/course.models
  • module:../utils/errors

Methods

# static createCourseSection(course_id, title) → {Object}

Create course section to group course contents

Parameters:
Name Type Description
course_id string

Id of course to add section to

title string

Title of course section

See:

View Source API/src/controllers/coursesection.controllers.js, line 41

if missing param in request body

BadRequestError

if course not found

NotFoundError
Object

# static deleteCourseSection(id) → {Object}

Delete course section

Parameters:
Name Type Description
id string

Id of course section

View Source API/src/controllers/coursesection.controllers.js, line 164

if missing param in request body

BadRequestError

if course section not found

NotFoundError

if course section still has linked exercises

ForbiddenError

if course section still has linked videos

ForbiddenError
Object

# static getCourseSectionData(id) → {Object}

Get all the contents of a course section, it includes videos, exercises and text materials of the course section. An additional field content is also added, it is an array of objects, each object contains the type of content and the content itself. The type of content can be either video, exercise or textmaterial. The content itself is the object of the content. These contents are sorted by the order they were added to the course section.

Parameters:
Name Type Description
id string

Id of course section

See:

View Source API/src/controllers/coursesection.controllers.js, line 82

if missing param in request body

BadRequestError

if course section not found

NotFoundError
Object

# static updateCourseSection(id) → {Object}

Update contents of a course section

Parameters:
Name Type Description
id string

Id of course section

req.body object

content to update in coursesection

View Source API/src/controllers/coursesection.controllers.js, line 120

if missing param in request body

BadRequestError

if course section not found

NotFoundError
Object