Showing
1 changed file
with
39 additions
and
0 deletions
models/Users.js
0 → 100644
1 | +const mongoose = require('mongoose'); | ||
2 | +const userSchema = mongoose.Schema({ | ||
3 | + name : { | ||
4 | + type : String, | ||
5 | + maxlength : 50 | ||
6 | + }, | ||
7 | + email :{ | ||
8 | + type : String, | ||
9 | + trim : true, // trim은 이메일 주소 받을때 공백을 없애준다. | ||
10 | + unique : 1 // 중복 허용 안함 | ||
11 | + }, | ||
12 | + password :{ | ||
13 | + type : String, | ||
14 | + minlength : 50 | ||
15 | + }, | ||
16 | + lastname:{ | ||
17 | + type : String, | ||
18 | + maxlength : 50 | ||
19 | + }, | ||
20 | + role:{ | ||
21 | + type : Number, // 1 : admin, 0 : common user | ||
22 | + default : 0 | ||
23 | + }, | ||
24 | + image: String, | ||
25 | + token: { | ||
26 | + type : String | ||
27 | + }, | ||
28 | + tokenExp :{ | ||
29 | + type: Number, | ||
30 | + } | ||
31 | + | ||
32 | +}) | ||
33 | + | ||
34 | +const User = mongoose.model('User', userSchema) | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | +model.exports = {} | ||
39 | + |
-
Please register or login to post a comment