Room.js 651 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
        type: String,
        required: true,
    },
    interest: {
        type: String,
        required: true,
우지원's avatar
우지원 committed
19
        // select: false
Choi Ga Young's avatar
aa    
Choi Ga Young committed
20
21
    },
    isOpen: {
우지원's avatar
우지원 committed
22
        type: Boolean,
Choi Ga Young's avatar
aa    
Choi Ga Young committed
23
        required: true,
우지원's avatar
수정    
우지원 committed
24
    },
우지원's avatar
e    
우지원 committed
25
26
27
28
    member: {
        type: Array,
        required: true,
    }
Choi Ga Young's avatar
aa    
Choi Ga Young committed
29
30
31
32
}, {
    timestamps: true
})

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