LoginID : String,
Password : String,
nameFamily : String,
nameGiven : String,
profilePicture : String
occupation : String
email : String // what if the user has multiple emails, how about use an array
phoneNumber: Number // what if the user has multiple phone numbers, how about use an array
UserID: String
status: String
contactList:[
contactInfor : objectID
]
@bin liang @Hongji Huang @Wei Zhao @Tian Yixiao please check!
// mongodb schema
const mongoose = require('mongoose')
// create mongoose schema
const userSchema = new mongoose.Schema({
loginID: {type: String, required: true},
password: {type: String, required: true},
lastName: {type: String, required: true},
firstName: {type: String, required: true},
portrait: { // store profile picture
data: Buffer,
contentType: String
},
occupation: {type: String, required: true},
email: {type: Array, required: true},
phone: {type: Array, required: true},
userID: {type: Array, required: true},
status: {type: Boolean, required: true}, // active, pending ? if only two status, consider use boolean
contactList: {type: Array, required: false}, // store a list of contact objects
})
const User = mongoose.model('Users', userSchema)
module.exports = User