Room.js 615 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
        type: String,
        required: true,
    },
    interest: {
        type: String,
        required: true,
        select: false
    },
    isOpen: {
Choi Ga Young's avatar
xxxxxxx    
Choi Ga Young committed
16
        type: Boolean,
Choi Ga Young's avatar
aa    
Choi Ga Young committed
17
        required: true,
우지원's avatar
수정    
우지원 committed
18
19
20
21
22
23
24
25
26
27
    },
    moderator: {
        type: String,
        required: true,
    },
    roomId: {
        type: String,
        // default:() => nanoid(),
        unique: true
    },
Choi Ga Young's avatar
aa    
Choi Ga Young committed
28
29
30
31
}, {
    timestamps: true
})

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