course.model.js 497 Bytes
Newer Older
Yoon, Daeki's avatar
Yoon, Daeki committed
1
2
3
4
5
import mongoose from 'mongoose'

const CourseSchema = new mongoose.Schema({
  name: String,
  description: String,
Yoon, Daeki's avatar
Yoon, Daeki committed
6
7
8
9
10
11
12
13
  code: {
    type: String,
    unique: true,
  }, // 코스 코드
  class: {
    type: Number,
    default: 0,
  }, // 분반
Yoon, Daeki's avatar
Yoon, Daeki committed
14
15
16
17
18
19
20
21
22
23
24
25
26
  image: {data: Buffer, contentType: String},
  instructor: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: 'User'
  },
  created: {
    type: Date,
    default: Date.now
  },
  updated: Date,
})

export default mongoose.model('Course', CourseSchema)