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.
49 lines
999 B
JavaScript
49 lines
999 B
JavaScript
//[SECTION] Modules and Dependencies
|
|
const mongoose = require('mongoose');
|
|
|
|
//[SECTION] Schema/Blueprint
|
|
const userSchema = new mongoose.Schema({
|
|
firstName: {
|
|
type: String,
|
|
required: [true, 'First Name is Required']
|
|
},
|
|
lastName: {
|
|
type: String,
|
|
required: [true, 'Last Name is Required']
|
|
},
|
|
email: {
|
|
type: String,
|
|
required: [true, 'Email is Required']
|
|
},
|
|
password: {
|
|
type: String,
|
|
required: [true, 'Password is Required']
|
|
},
|
|
isAdmin: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
mobileNo: {
|
|
type: String,
|
|
required: [true, 'Mobile Number is Required']
|
|
},
|
|
enrollments: [
|
|
{
|
|
courseId: {
|
|
type: String,
|
|
required: [true, 'Subject ID is Required']
|
|
},
|
|
enrolledOn: {
|
|
type: Date,
|
|
default: new Date()
|
|
},
|
|
status: {
|
|
type: String,
|
|
default: 'Enrolled'
|
|
}
|
|
}
|
|
]
|
|
});
|
|
|
|
//[SECTION] Model
|
|
module.exports = mongoose.model('User', userSchema);
|