User.js 769 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']
Jiwon Yoon's avatar
Jiwon Yoon committed
36
37
38
39
40
41
    }
}, {
    timestamps: true
})

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