Module

CourseModel

This module contains the models for courses, such as the course model, the course section model, the exercise model, and the question model.

View Source API/src/models/course.models.js, line 1

Requires

  • module:mongoose

Members

courseReportSchema

# inner constant courseReportSchema

View Source API/src/models/course.models.js, line 510

courseSchema

# inner constant courseSchema

View Source API/src/models/course.models.js, line 413

courseSectionSchema

# inner constant courseSectionSchema

View Source API/src/models/course.models.js, line 347

downloadableResourceSchema

# inner constant downloadableResourceSchema

View Source API/src/models/course.models.js, line 328

exerciseSchema

# inner constant exerciseSchema

View Source API/src/models/course.models.js, line 234

submissionSchema

# inner constant exerciseSubmissionSchema

View Source API/src/models/course.models.js, line 454

questionSchema

# inner constant questionSchema

View Source API/src/models/course.models.js, line 207

textmaterialSchema

# inner constant textmaterialSchema

View Source API/src/models/course.models.js, line 297

videoSchema

# inner constant videoSchema

View Source API/src/models/course.models.js, line 258

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

View Source API/src/models/course.models.js, line 384

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

See:

View Source API/src/models/course.models.js, line 185

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

See:

View Source API/src/models/course.models.js, line 146

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

See:

View Source API/src/models/course.models.js, line 121

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

See:

View Source API/src/models/course.models.js, line 104

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

See:

View Source API/src/models/course.models.js, line 43

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

See:

View Source API/src/models/course.models.js, line 29

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

See:

View Source API/src/models/course.models.js, line 165

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

See:

View Source API/src/models/course.models.js, line 86

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

See:

View Source API/src/models/course.models.js, line 65