You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
818 B
JavaScript
41 lines
818 B
JavaScript
2 months ago
|
//[SECTION] Dependencies and Modules
|
||
|
const mongoose = require('mongoose');
|
||
|
|
||
|
//[SECTION] Schema/Blueprint
|
||
|
const courseSchema = new mongoose.Schema({
|
||
|
name: {
|
||
|
type: String,
|
||
|
required: [true, 'is Required']
|
||
|
},
|
||
|
description: {
|
||
|
type: String,
|
||
|
required: [true, 'is Required']
|
||
|
},
|
||
|
price: {
|
||
|
type: Number,
|
||
|
required: [true, 'Course Price is Required']
|
||
|
},
|
||
|
isActive: {
|
||
|
type: Boolean,
|
||
|
default: true
|
||
|
},
|
||
|
createdOn: {
|
||
|
type: Date,
|
||
|
default: new Date()
|
||
|
},
|
||
|
enrollees: [
|
||
|
{
|
||
|
userId: {
|
||
|
type: String,
|
||
|
required: [true, 'Student ID is Required']
|
||
|
},
|
||
|
enrolledOn: {
|
||
|
type: Date,
|
||
|
default: new Date()
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
});
|
||
|
|
||
|
//[SECTION] Model
|
||
|
module.exports = mongoose.model('Course', courseSchema);
|