This module contains the models for courses, such as the course model, the course section model, the exercise model, and the question model.
Requires
- module:mongoose
Members
courseReportSchema
# inner constant courseReportSchema
courseSectionSchema
# inner constant courseSectionSchema
downloadableResourceSchema
# inner constant downloadableResourceSchema
exerciseSchema
# inner constant exerciseSchema
submissionSchema
# inner constant exerciseSubmissionSchema
questionSchema
# inner constant questionSchema
textmaterialSchema
# inner constant textmaterialSchema
Methods
# inner combineContents(courseSection) → {courseSectionSchema}
Combines the contents of the course section into one array and sorts them by their order
Parameters:
Name | Type | Description |
---|---|---|
courseSection |
courseSectionSchema
|
courseSectionSchema
Type Definitions
Object
# courseReportSchema
This schema is used to track the progress of a user in a course.
Properties:
Name | Type | Description |
---|---|---|
user |
ObjectId
|
The user |
course |
ObjectId
|
The course |
completed_exercises |
Array.<ObjectId>
|
The exercises completed by the user |
completed_videos |
Array.<ObjectId>
|
The videos completed by the user |
completed_course_sections |
Array.<ObjectId>
|
The course sections completed by the user |
isCompleted |
Boolean
|
Whether the user has completed the course |
Object
# courseSchema
This schema is used to store courses.
Properties:
Name | Type | Description |
---|---|---|
title |
String
|
The title of the course |
description |
String
|
The description of the course |
author |
String
|
The author of the course |
course_sections |
Array.<MongooseVirtualType>
|
The course sections in the course |
exercises |
Array.<MongooseVirtualType>
|
The exercises in the course |
videos |
Array.<MongooseVirtualType>
|
The videos in the course |
textmaterials |
Array.<MongooseVirtualType>
|
The text materials in the course |
Object
# courseSectionSchema
This schema is used to store course sections.
Properties:
Name | Type | Description |
---|---|---|
type |
String
|
The type of the document, "course_section" |
title |
String
|
The title of the course section |
order |
Number
|
The order of the course section in the course |
course |
ObjectId
|
The course to which the course section belongs |
contents |
Array.<MongooseVirtualType>
|
The contents of the course section |
isAvailable |
Boolean
|
Whether the course section is available to the user |
exercises |
Array.<MongooseVirtualType>
|
The exercises in the course section |
videos |
Array.<MongooseVirtualType>
|
The videos in the course section |
textmaterials |
Array.<MongooseVirtualType>
|
The text materials in the course section NOTE: The contents of the course section are stored as an array of virtuals. This is because the contents can be either an exercises, videos or text materials |
Object
# downloadableResourceSchema
This schema is used to store downloadable resources. These are resources that can be downloaded by the user. they are usually links to files such as pdfs, word documents, etc.
Properties:
Name | Type | Description |
---|---|---|
type |
String
|
The type of the document, "downloadable_resource" |
title |
String
|
The title of the downloadable resource |
file_url |
String
|
The url of the downloadable resource |
course |
ObjectId
|
The course to which the downloadable resource belongs |
order |
Number
|
The order of the downloadable resource in the course section |
isAvailable |
Boolean
|
Whether the downloadable resource is available to the user |
Object
# exerciseSchema
This schema is used to store exercises.
Properties:
Name | Type | Description |
---|---|---|
type |
String
|
The type of the document, "exercise" |
title |
String
|
The title of the exercise |
description |
String
|
The description of the exercise |
duration |
Number
|
The duration of the exercise |
date |
Date
|
The date the exercise was created |
course |
ObjectId
|
The course to which the exercise belongs |
course_section |
ObjectId
|
The course section to which the exercise belongs |
order |
Number
|
The order of the exercise in the course section |
questions |
Array.<MongooseVirtualType>
|
The questions for the exercise |
Object
# questionSchema
This schema is used to store questions for exercises.
Properties:
Name | Type | Description |
---|---|---|
type |
String
|
The type of the document, "question" |
exercise |
ObjectId
|
The exercise to which the question belongs |
question |
String
|
The question |
correct_option |
String
|
The correct option |
options |
Array
|
The options for the question |
Object
# submissionSchema
This schema is used to store the record of all the submissions for a particular exercise made by a particular user.
Properties:
Name | Type | Description |
---|---|---|
user |
ObjectId
|
The user who made the submission |
exercise |
ObjectId
|
The exercise for which the submission was made |
score |
Number
|
The score of the submission |
submission |
Object
|
The submission |
question |
String
|
The question |
correct_option |
String
|
The correct option |
submitted_option |
String
|
The option selected by the user |
date |
Date
|
The date the submission was made |
Object
# textmaterialSchema
This schema is used to store text materials. text materials are documents such as pdfs, word documents, etc. that are used within the course
Properties:
Name | Type | Description |
---|---|---|
type |
String
|
The type of the document, "text_material" |
title |
String
|
The title of the text material |
file_url |
String
|
The url of the text material |
course |
ObjectId
|
The course to which the text material belongs |
course_section |
ObjectId
|
The course section to which the text material belongs |
order |
Number
|
The order of the text material in the course section |
isAvailable |
Boolean
|
Whether the text material is available to the user |
Object
# videoSchema
This schema is used to store videos.
Properties:
Name | Type | Description |
---|---|---|
type |
String
|
The type of the document, "video" |
title |
String
|
The title of the video |
description |
String
|
The description of the video |
video_url |
String
|
The url of the video |
duration |
Number
|
The duration of the video |
course |
ObjectId
|
The course to which the video belongs |
course_section |
ObjectId
|
The course section to which the video belongs |
order |
Number
|
The order of the video in the course section |
category |
String
|
The category of the video (e.g. "Programming", "Mathematics", "Physics", "Chemistry") |
isAvailable |
Boolean
|
Whether the video is available to the user |