mirror of
https://github.com/atlanticbiomedical/biomedjs.git
synced 2025-07-02 00:47:26 -04:00
41 lines
738 B
JavaScript
41 lines
738 B
JavaScript
var mongoose = require('mongoose'),
|
|
Schema = mongoose.Schema,
|
|
ObjectId = Schema.ObjectId;
|
|
|
|
var userSchema = new Schema({
|
|
name: {
|
|
first: String,
|
|
last: String
|
|
},
|
|
email: String,
|
|
picture: String,
|
|
refreshToken: String,
|
|
accessToken: String,
|
|
groups: [String],
|
|
perms: [String],
|
|
|
|
employmentType: {
|
|
type: String,
|
|
enum: ['hourly', 'salary'],
|
|
default: 'hourly',
|
|
required: true
|
|
},
|
|
|
|
unpaidTravel: {
|
|
type: Number,
|
|
default: 0,
|
|
required: true
|
|
},
|
|
|
|
deleted: {
|
|
type: Boolean,
|
|
default: false
|
|
}
|
|
});
|
|
|
|
userSchema.methods.hasPermission = function(perm) {
|
|
return this.perms.indexOf(perm) != -1;
|
|
}
|
|
|
|
var User = module.exports = mongoose.model('User', userSchema);
|