1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-12-04 19:32:20 -05:00
shimapan/app/models/User.js

54 lines
1018 B
JavaScript
Raw Normal View History

const mongoose = require('mongoose');
const passportLocalMongoose = require('passport-local-mongoose');
const config = require('config');
2017-10-09 22:01:02 -04:00
const UserSchema = mongoose.Schema({
2017-10-09 22:01:02 -04:00
username: {
type: String,
unique: true,
required: true
},
displayname: {
type: String,
unique: true,
required: true
},
scope: {
type: [String],
required: true
},
2017-10-14 15:13:50 -04:00
uploadCount: {
type: Number,
default: 0
},
2017-10-14 15:13:50 -04:00
uploadSize: {
type: Number,
default: 0
},
date: {
type: Date,
default: Date.now
2018-08-12 05:30:50 -04:00
},
banned: {
type: Boolean,
default: false,
expires: {
type: Date,
default: null
}
}
2017-10-09 22:01:02 -04:00
});
2018-07-25 18:45:08 -04:00
UserSchema.plugin(passportLocalMongoose, {
saltlen: config.get('User.Password.saltLength'),
iterations: config.get('User.Password.hashIterations'),
2018-07-25 18:45:08 -04:00
limitAttempts: true
});
2017-10-09 22:01:02 -04:00
module.exports = mongoose.model('User', UserSchema);