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.
50 lines
740 B
JavaScript
50 lines
740 B
JavaScript
// dependencies and modules
|
|
// this are still empty unless we push somthing to it in the controller
|
|
const mongoose = require('mongoose');
|
|
|
|
const courseSchema = 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); |