-
Notifications
You must be signed in to change notification settings - Fork 142
Expand file tree
/
Copy pathadmin.js
More file actions
38 lines (36 loc) · 667 Bytes
/
admin.js
File metadata and controls
38 lines (36 loc) · 667 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
*
* @author: Mr_Wei
* @version: 1.0.0
* @description: 管理员模型
* @Date: 2019/10/16 11:05
*
*/
const bcrypt = require("bcrypt");
const mongoose = require("mongoose");
const adminModel = mongoose.Schema({
email:{
require:true,
type:String
},
username:{
require:true,
type:String
},
password:{
require:true,
type:String,
set(val){
return bcrypt.hashSync(val, 10)
}
},
identity:{
// require:true,
type:String
},
date:{
require:true,
type:String
}
})
module.exports = mongoose.model("Admin", adminModel)