Cantilever-Labs/models/User.js

76 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-05-09 04:31:53 -07:00
const mongoose = require("mongoose");
2021-05-11 07:18:54 -07:00
const crypto = require("crypto");
2021-05-09 04:31:53 -07:00
const Schema = mongoose.Schema;
2021-03-26 06:29:27 -07:00
const userSchema = new Schema({
2021-05-10 03:10:10 -07:00
2021-05-09 04:31:53 -07:00
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,
},
2021-05-11 07:18:54 -07:00
passwordResetToken: String,
passwordResetExpires: Date,
2021-05-09 04:31:53 -07:00
//need to add isAdmin
});
2021-03-26 06:29:27 -07:00
firstName : {
type :String ,
required : true
} ,
lastName : {
type:String ,
required: true
} ,
email : {
type:String ,
required: true
} ,
password : {
2021-04-01 06:38:27 -07:00
type : String
} ,
googleId : {
type : String
} ,
student : {
type : mongoose.Types.ObjectId ,
ref: 'Student'
2021-04-12 05:44:50 -07:00
} ,
isAdmin : {
type : Boolean
} ,
numLoggedIn : {
type : Number
} ,
clicked : {
type : Object
2021-03-26 06:29:27 -07:00
}
//need to add isAdmin
2021-03-26 06:29:27 -07:00
}) ;
2021-05-10 03:10:10 -07:00
2021-05-09 04:31:53 -07:00
module.exports = mongoose.model("User", userSchema);