2017-10-09 22:01:02 -04:00
|
|
|
var mongoose = require('mongoose');
|
2017-10-18 13:31:08 -04:00
|
|
|
var passportLocalMongoose = require('passport-local-mongoose');
|
2017-10-09 22:01:02 -04:00
|
|
|
|
|
|
|
var UserSchema = mongoose.Schema({
|
|
|
|
username: {
|
|
|
|
type: String,
|
|
|
|
unique: true,
|
|
|
|
required: true
|
|
|
|
},
|
2018-01-15 15:29:32 -05:00
|
|
|
canonicalname: {
|
|
|
|
type: String,
|
|
|
|
unique: true,
|
|
|
|
required: true
|
|
|
|
},
|
2017-10-18 13:31:08 -04:00
|
|
|
scope: [String],
|
2017-10-14 15:13:50 -04:00
|
|
|
uploadCount: {
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
uploadSize: {
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
},
|
2017-10-11 12:55:46 -04:00
|
|
|
date: Date
|
2017-10-09 22:01:02 -04:00
|
|
|
});
|
|
|
|
|
2018-01-15 15:29:32 -05:00
|
|
|
UserSchema.plugin(passportLocalMongoose, {usernameField: 'canonicalname'});
|
2017-10-09 22:01:02 -04:00
|
|
|
|
|
|
|
module.exports = mongoose.model('User', UserSchema);
|