1- const mongoose = require ( " mongoose" ) ;
1+ const mongoose = require ( ' mongoose' ) ;
22// const bcrypt = require('bcrypt-nodejs');
33
44mongoose . Promise = global . Promise ;
@@ -9,10 +9,10 @@ const userSchema = mongoose.Schema({
99 lastName : { type : String } ,
1010 } ,
1111 email : { type : String , unique : true } ,
12- accessLevel : {
13- type : String ,
14- enum : [ " user" , " admin" , " superadmin" ] , // restricts values to "user", "admin" and "superadmin"
15- default : " user"
12+ accessLevel : {
13+ type : String ,
14+ enum : [ ' user' , ' admin' , ' superadmin' ] , // restricts values to "user", "admin" and "superadmin"
15+ default : ' user' ,
1616 } ,
1717 createdDate : { type : Date , default : Date . now } ,
1818 currentRole : { type : String } , // will remove but need to update check-in form
@@ -27,7 +27,7 @@ const userSchema = mongoose.Schema({
2727 projects : [
2828 {
2929 type : mongoose . Schema . Types . ObjectId ,
30- ref : " Project" ,
30+ ref : ' Project' ,
3131 } ,
3232 ] ,
3333 githubHandle : { type : String } , // handle not including @, not the URL
@@ -37,10 +37,15 @@ const userSchema = mongoose.Schema({
3737 isHflaGithubMember : { type : Boolean } , // pull from API once github handle in place?
3838 githubPublic2FA : { type : Boolean } , // does the user have 2FA enabled on their github and membership set to public?
3939 availability : { type : String } , // availability to meet outside of hacknight times; string for now, more structured in future
40- managedProjects : [ { type : String } ] , // Which projects managed by user.
40+ managedProjects : [
41+ {
42+ type : mongoose . Schema . Types . ObjectId ,
43+ ref : 'Project' ,
44+ } ,
45+ ] , // Which projects managed by user.
4146 //currentProject: { type: String } // no longer need this as we can get it from Project Team Member table
4247 // password: { type: String, required: true }
43- isActive : { type : Boolean , default : true }
48+ isActive : { type : Boolean , default : true } ,
4449} ) ;
4550
4651userSchema . methods . serialize = function ( ) {
@@ -71,10 +76,10 @@ userSchema.methods.serialize = function () {
7176 githubPublic2FA : this . githubPublic2FA ,
7277 availability : this . availability ,
7378 managedProjects : this . managedProjects ,
74- isActive : this . isActive
79+ isActive : this . isActive ,
7580 } ;
7681} ;
7782
78- const User = mongoose . model ( " User" , userSchema ) ;
83+ const User = mongoose . model ( ' User' , userSchema ) ;
7984
8085module . exports = { User } ;
0 commit comments