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
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 |
- 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 |
- 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 |
- 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 |
- 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 |
- 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 |
- The uploaded resource
Object