Users.js
719 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
39
const mongoose = require('mongoose');
const userSchema = mongoose.Schema({
name : {
type : String,
maxlength : 50
},
email :{
type : String,
trim : true, // trim은 이메일 주소 받을때 공백을 없애준다.
unique : 1 // 중복 허용 안함
},
password :{
type : String,
minlength : 50
},
lastname:{
type : String,
maxlength : 50
},
role:{
type : Number, // 1 : admin, 0 : common user
default : 0
},
image: String,
token: {
type : String
},
tokenExp :{
type: Number,
}
})
const User = mongoose.model('User', userSchema)
model.exports = {}