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.
48 lines
665 B
JavaScript
48 lines
665 B
JavaScript
1 year ago
|
// dependencies and modules
|
||
|
|
||
|
const mongoose = require('mongoose');
|
||
|
|
||
|
const courseSchwema = new mongoose.Schema({
|
||
|
name:{
|
||
|
type:String,
|
||
|
required: [true,"Course is required"]
|
||
|
},
|
||
|
|
||
|
description: {
|
||
|
type:String,
|
||
|
required:[true, "Description is required"]
|
||
|
},
|
||
|
|
||
|
price:{
|
||
|
type:number
|
||
|
required:[true, "Price is required"]
|
||
|
},
|
||
|
|
||
|
isActive:{
|
||
|
type: Boolean,
|
||
|
default: true
|
||
|
},
|
||
|
|
||
|
createdOn:{
|
||
|
type:Date,
|
||
|
default: new Date()
|
||
|
},
|
||
|
|
||
|
enrollees:[{
|
||
|
|
||
|
userID:{
|
||
|
type:String
|
||
|
required:[true, "User Id is required"]
|
||
|
},
|
||
|
enrolledOn:{
|
||
|
type: Date,
|
||
|
default: new Date
|
||
|
}
|
||
|
|
||
|
}
|
||
|
]
|
||
|
|
||
|
});
|
||
|
|
||
|
// Model Exports
|
||
|
module.exports = mongoose.model('Course', courseSchema);
|