Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var userrSchema = new mongoose.Schema({
- email : {
- type: String,
- required: "Email can't be empty.",
- // unique: true
- },
- password: {
- type: String,
- required: "Password name can't be empty."
- },
- firstName : {
- type: String,
- required: "First name can't be empty."
- },
- lastName : {
- type: String,
- required: "Last name can't be empty."
- },
- phoneNumber : {
- type: String,
- required: "Reqired for further contact. Can't be empty."
- },
- verify: String,
- role: String,
- emailResetTokennn: String,
- emailExpiress: Date,
- saltSecret: String
- });
- mongoose.model('Userr' , userrSchema);
- //define admin(main) schema
- var adminSchema = new mongoose.Schema({
- companyName : {
- type: String,
- required: "Company name can't be empty.",
- required: false
- },
- companyID: {
- type: String,
- },
- address : {
- type: String,
- required: "Address can't be empty.",
- },
- contactDetails : {
- type: String,
- required: "Company contact number can't be empty.",
- },
- admins: {
- _id: mongoose.Schema.Types.ObjectId,
- email : {
- type: String,
- required: "Email can't be empty.",
- unique: true
- },
- password: {
- type: String,
- required: "Password name can't be empty."
- },
- firstName : {
- type: String,
- required: "First name can't be empty."
- },
- lastName : {
- type: String,
- required: "Last name can't be empty."
- },
- phoneNumber : {
- type: String,
- required: "Reqired for further contact. Can't be empty."
- },
- designation : {
- type: String,
- required: "Designation can't be empty."
- },
- verified: String,
- role: String,
- emailResetTokenn: String,
- emailExpires: Date,
- saltSecret: String,//this is user for encryption and decryption of password
- users:[ { type: mongoose.Schema.Types.ObjectId, ref: 'Userr' } ]
- }
- });
- mongoose.model('Admin', adminSchema);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement