Room.js 671 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
    roomName: {
Choi Ga Young's avatar
aa    
Choi Ga Young committed
7
8
9
10
11
12
13
14
15
16
17
18
        type: String,
        required: true,
    },
    interest: {
        type: String,
        required: true,
        select: false
    },
    isOpen: {
        type: String,
        required: true,
        default: 'user',
우지원's avatar
수정    
우지원 committed
19
20
21
22
23
24
25
26
27
28
29
        enum: ['true', 'false']
    },
    moderator: {
        type: String,
        required: true,
    },
    roomId: {
        type: String,
        // default:() => nanoid(),
        unique: true
    },
Choi Ga Young's avatar
aa    
Choi Ga Young committed
30
31
32
33
}, {
    timestamps: true
})

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