chat.js 539 Bytes
Newer Older
Soo Hyun Kim's avatar
Soo Hyun Kim committed
1
2
3
4
5
import mongoose from 'mongoose'

const {String} = mongoose.Schema.Types

const ChatSchema = 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
12
13
14
15
16
17
18
19
20
    name: {
        type: String,
        required: true,
    },
    interest: {
        type: String,
        required: true,
        select: false
    },
    isOpen: {
Soo Hyun Kim's avatar
Soo Hyun Kim committed
21
        type: Boolean,
Soo Hyun Kim's avatar
Soo Hyun Kim committed
22
23
24
25
26
27
        required: true,
    }
}, {
    timestamps: true
})

Soo Hyun Kim's avatar
Soo Hyun Kim committed
28
export default mongoose.models.Chat || mongoose.model('Chat', ChatSchema)