User.js 770 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
20

    number1: {
Jiwon Yoon's avatar
Jiwon Yoon committed
21
22
23
        type: String,
        required: true,
    },
이재연's avatar
이재연 committed
24
    number2: {
Jiwon Yoon's avatar
Jiwon Yoon committed
25
26
27
        type: String,
        required: true,
    },
이재연's avatar
이재연 committed
28
    tel: {
Jiwon Yoon's avatar
Jiwon Yoon committed
29
30
31
        type: String,
        required: true,
    },
이재연's avatar
이재연 committed
32
    role: {
Jiwon Yoon's avatar
Jiwon Yoon committed
33
34
        type: String,
        required: true,
이재연's avatar
이재연 committed
35
36
        default: 'user',
        enum: ['user', 'admin', 'root']
Jiwon Yoon's avatar
Jiwon Yoon committed
37
38
39
40
41
42
    }
}, {
    timestamps: true
})

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