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
704 B
JavaScript
41 lines
704 B
JavaScript
const mongoose = require("mongoose");
|
|
|
|
// Schema/Blueprint
|
|
const userSchema = new mongoose.Schema({
|
|
firstName: {
|
|
type: String,
|
|
required: [true, 'FirstName is required']
|
|
|
|
},
|
|
|
|
lastName: {
|
|
type: String,
|
|
required: [true, 'lastName is required']
|
|
|
|
},
|
|
|
|
email: {
|
|
type: String,
|
|
required: [true, 'Email is required']
|
|
|
|
},
|
|
|
|
mobileNo: {
|
|
type: Number,
|
|
required: [true, 'MobileNumber is required']
|
|
|
|
},
|
|
|
|
isAdmin: {
|
|
type: Boolean,
|
|
default: false, // Assuming new users are not admins by default
|
|
},
|
|
|
|
password: {
|
|
type: String,
|
|
required: [true,'Password is required']
|
|
}
|
|
});
|
|
|
|
// Model
|
|
module.exports = mongoose.model("User", userSchema); |