76 lines
1.2 KiB
JavaScript
76 lines
1.2 KiB
JavaScript
const mongoose = require("mongoose");
|
|
const crypto = require("crypto");
|
|
const Schema = mongoose.Schema;
|
|
|
|
const userSchema = new Schema({
|
|
|
|
firstName: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
lastName: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
email: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
password: {
|
|
type: String,
|
|
},
|
|
googleId: {
|
|
type: String,
|
|
},
|
|
student: {
|
|
type: mongoose.Types.ObjectId,
|
|
ref: "Student",
|
|
},
|
|
isAdmin: {
|
|
type: Boolean,
|
|
},
|
|
otp: {
|
|
type: String,
|
|
},
|
|
passwordResetToken: String,
|
|
passwordResetExpires: Date,
|
|
//need to add isAdmin
|
|
});
|
|
|
|
firstName : {
|
|
type :String ,
|
|
required : true
|
|
} ,
|
|
lastName : {
|
|
type:String ,
|
|
required: true
|
|
} ,
|
|
email : {
|
|
type:String ,
|
|
required: true
|
|
} ,
|
|
password : {
|
|
type : String
|
|
} ,
|
|
googleId : {
|
|
type : String
|
|
} ,
|
|
student : {
|
|
type : mongoose.Types.ObjectId ,
|
|
ref: 'Student'
|
|
} ,
|
|
isAdmin : {
|
|
type : Boolean
|
|
} ,
|
|
numLoggedIn : {
|
|
type : Number
|
|
} ,
|
|
clicked : {
|
|
type : Object
|
|
}
|
|
//need to add isAdmin
|
|
}) ;
|
|
|
|
|
|
module.exports = mongoose.model("User", userSchema);
|