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

const {String} = mongoose.Schema.Types
우지원's avatar
e    
우지원 committed
4
const {Array} = mongoose.Schema.Types
Choi Ga Young's avatar
aa    
Choi Ga Young committed
5
6

const RoomSchema = new mongoose.Schema({
우지원's avatar
e    
우지원 committed
7
8
9
10
11
    roomId: {
        type: String,
        // default:() => nanoid(),
        unique: true
    },
Soo Hyun Kim's avatar
Soo Hyun Kim committed
12
    roomName: {
Choi Ga Young's avatar
aa    
Choi Ga Young committed
13
14
15
16
17
18
19
20
21
        type: String,
        required: true,
    },
    interest: {
        type: String,
        required: true,
        select: false
    },
    isOpen: {
우지원's avatar
우지원 committed
22
        type: Boolean,
Choi Ga Young's avatar
aa    
Choi Ga Young committed
23
        required: true,
우지원's avatar
수정    
우지원 committed
24
25
26
27
28
    },
    moderator: {
        type: String,
        required: true,
    },
우지원's avatar
e    
우지원 committed
29
30
31
32
    member: {
        type: Array,
        required: true,
    }
Choi Ga Young's avatar
aa    
Choi Ga Young committed
33
34
35
36
}, {
    timestamps: true
})

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