44 lines
814 B
44 lines
814 B
9 months ago
|
'use strict';
|
||
|
|
||
|
module.exports = app => {
|
||
|
const mongoose = app.mongoose;
|
||
|
const Schema = mongoose.Schema;
|
||
|
|
||
|
const UserSchema = new Schema({
|
||
|
submission: {
|
||
|
username: {
|
||
|
type: String,
|
||
|
unique: true,
|
||
|
index: true
|
||
|
},
|
||
|
password: {
|
||
|
type: String,
|
||
|
index: true
|
||
|
},
|
||
|
},
|
||
|
role: { //角色信息,默认操作员
|
||
|
type: String,
|
||
|
default: 'operator',
|
||
|
index: true
|
||
|
},
|
||
|
delete: {
|
||
|
type: Number,
|
||
|
default: 0, //0代表未删除,1代表删除
|
||
|
index: true
|
||
|
},
|
||
|
create_at: {
|
||
|
type: Date,
|
||
|
default: Date.now,
|
||
|
index: true
|
||
|
},
|
||
|
update_at: {
|
||
|
type: Date,
|
||
|
default: Date.now,
|
||
|
index: true
|
||
|
},
|
||
|
}, {
|
||
|
strict: false
|
||
|
});
|
||
|
return mongoose.model('user', UserSchema, "user");
|
||
|
};
|