Module

TextMaterial Controller

This module is responsible for handling all text material related requests

The following routes are handled by this module::


POST /textmaterial/new - Add a new text material to a particular course section
GET /textmaterial/:id - Get a particular text material
PATCH /textmaterial/update/:id - Update a particular text material
DELETE /textmaterial/delete/:id - Delete a particular text material

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

Requires

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

Methods

# static deleteTextMaterial(id) → {Object}

Delete text material

Parameters:
Name Type Description
id string

Id of text material

View Source API/src/controllers/textmaterial.controllers.js, line 220

if missing param in request params

BadRequestError

if text material not found

NotFoundError
Object

# static getTextMaterialData(id) → {Object}

Get text material data, including course section and course data

Parameters:
Name Type Description
id string

Id of text material

See:

View Source API/src/controllers/textmaterial.controllers.js, line 127

if missing param in request params

BadRequestError

if text material not found

NotFoundError
Object

# static updateTextMaterial(id, title, description) → {Object}

Update text material

Parameters:
Name Type Description
id string

Id of text material

title string

Title of text material

description string

Description of text material

View Source API/src/controllers/textmaterial.controllers.js, line 171

if missing param in request params

BadRequestError

if text material not found

NotFoundError
Object

# static uploadTextMaterial(course_section_id, title, description, course_id) → {Object}

Add text material to course section, the text material can be a pdf, docx, pptx, etc.


The text material is first uploaded to cloudinary saving the cloudinary url to the database

Parameters:
Name Type Description
course_section_id string

Id of course section to add text material to

title string

Title of text material

description string

Description of text material

course_id string

Id of course

See:

View Source API/src/controllers/textmaterial.controllers.js, line 57

if missing param in request body

BadRequestError

if course section not found

NotFoundError
Object