User.js 882 Bytes
Newer Older
이재연's avatar
이재연 committed
1
import mongoose from "mongoose";
Jiwon Yoon's avatar
Jiwon Yoon committed
2
3
4
5
6
7

const { String } = mongoose.Schema.Types

const UserSchema = new mongoose.Schema({
    name: {
        type: String,
이재연's avatar
이재연 committed
8
        required: true, 
Jiwon Yoon's avatar
Jiwon Yoon committed
9
10
11
12
    },
    id: {
        type: String,
        required: true,
이재연's avatar
이재연 committed
13
        unique: true,
Jiwon Yoon's avatar
Jiwon Yoon committed
14
15
16
17
18
    },
    password: {
        type: String,
        required: true,
    },
이재연's avatar
이재연 committed
19
    number1: {
Jiwon Yoon's avatar
Jiwon Yoon committed
20
21
22
        type: String,
        required: true,
    },
이재연's avatar
이재연 committed
23
    number2: {
Jiwon Yoon's avatar
Jiwon Yoon committed
24
25
26
        type: String,
        required: true,
    },
이재연's avatar
이재연 committed
27
    tel: {
Jiwon Yoon's avatar
Jiwon Yoon committed
28
29
30
        type: String,
        required: true,
    },
이재연's avatar
이재연 committed
31
    role: {
Jiwon Yoon's avatar
Jiwon Yoon committed
32
33
        type: String,
        required: true,
이재연's avatar
이재연 committed
34
35
        default: 'user',
        enum: ['user', 'admin', 'root']
박상호's avatar
박상호 committed
36
    },
박상호's avatar
0120    
박상호 committed
37
38
39
40
    email : {
        type : String,
        required: true,
    },
박상호's avatar
박상호 committed
41
42
    avatarUrl: {
        type: String
Jiwon Yoon's avatar
Jiwon Yoon committed
43
44
45
46
47
48
    }
}, {
    timestamps: true
})

export default mongoose.models.User || mongoose.model('User', UserSchema)