AccessInfo.js 592 Bytes
Newer Older
Choi Ga Young's avatar
x    
Choi Ga Young committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import mongoose from 'mongoose'

const { String } = mongoose.Schema.Types

const AccessInfoSchema = new mongoose.Schema({
  room: {
    type: mongoose.ObjectId,
    required: true,
    ref: 'Room',
  },
  userInfo: {
    type: mongoose.ObjectId,
    required: true,
    unique: true,
    ref: 'User',
  },
  nickname: {
    type: String,
    required: true,
  },
  isEnt: {
    type: Boolean,
    required: true,
    default: true, // 입장 시 true, 퇴장 시 false
  }
}, {
  timestamps: true
})

export default mongoose.models.AccessInfo || mongoose.model('AccessInfo', AccessInfoSchema)