Room.js 608 Bytes
Newer Older
Choi Ga Young's avatar
aa    
Choi Ga Young committed
1
2
3
4
5
import mongoose from 'mongoose'

const {String} = mongoose.Schema.Types

const RoomSchema = new mongoose.Schema({
Soo Hyun Kim's avatar
Soo Hyun Kim committed
6
7
8
9
10
    roomId: {
        type: String,
        // default:() => nanoid(),
        unique: true
    },
Soo Hyun Kim's avatar
Soo Hyun Kim committed
11
    roomName: {
Choi Ga Young's avatar
aa    
Choi Ga Young committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
        type: String,
        required: true,
    },
    interest: {
        type: String,
        required: true,
        select: false
    },
    isOpen: {
        type: String,
        required: true,
        default: 'user',
        enum: ['user', 'admin', 'root']
    }
}, {
    timestamps: true
})

30
export default mongoose.models.Room || mongoose.model('Room', RoomSchema)