Chat.js 510 Bytes
Newer Older
Soo Hyun Kim's avatar
Soo Hyun Kim committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import mongoose from 'mongoose'

const {String} = mongoose.Schema.Types

const ChatSchema = new mongoose.Schema({
    name: {
        type: String,
        required: true,
    },
    interest: {
        type: String,
        required: true,
        select: false
    },
    isOpen: {
        type: String,
        required: true,
        default: 'user',
        enum: ['user', 'admin', 'root']
    }
}, {
    timestamps: true
})

JeongYeonwoo's avatar
0113    
JeongYeonwoo committed
25
export default mongoose.models.ChatSchema || mongoose.model('chat', ChatSchema)