Module

DownloadableResources Controller

Controller for downloadable resources, including text materials and videos

The following routes are handled here:

</br

POST /downloadableresource/new
POST /downloadableresource/upload
PATCH /downloadableresource/update/:id
DELETE /downloadableresource/delete/:id

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

Methods

# static createDownloadableResource(course_id, title, description, file_url) → {Object}

This function is used to create downloadable resource. This is used when the user wants to create a resource with a url to the file

Parameters:
Name Type Description
course_id String

The course id

title String

The title of the resource

description String

The description of the resource

file_url String

The url to the file

View Source API/src/controllers/downloadableresources.controllers.js, line 247

  • The created resource
Object

# static deleteDownloadableResource(id) → {Object}

This function is used to delete downloadable resource

Parameters:
Name Type Description
id String

The resource id

View Source API/src/controllers/downloadableresources.controllers.js, line 110

  • The deleted resource
Object

# static getDownloadableResourceData(id, req, res, next) → {Object}

This function is used to get downloadable resource data

Parameters:
Name Type Description
id String

The resource id

req Request

Express request object

res Response

Express response object

next NextFunction

Express next function

View Source API/src/controllers/downloadableresources.controllers.js, line 80

  • The resource data
Object

# static getDownloadableResources(id, req, res, next) → {Object}

This function is used to get all downloadable resources

Parameters:
Name Type Description
id String

The course id

req Request

Express request object

res Response

Express response object

next NextFunction

Express next function

View Source API/src/controllers/downloadableresources.controllers.js, line 36

  • The downloadable resources
Object

# static updateDownloadableResource(id) → {Object}

This function is used to update downloadable resource. The user can update the title, description and file url

Parameters:
Name Type Description
id String

The resource id

View Source API/src/controllers/downloadableresources.controllers.js, line 144

  • The updated resource
Object

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

This function is used to upload downloadable resource. This is used when the user wants to upload a file to the server

Parameters:
Name Type Description
id String

The course id

title String

The title of the resource

description String

The description of the resource

file String

The file to be uploaded

View Source API/src/controllers/downloadableresources.controllers.js, line 183

  • The uploaded resource
Object