quiz.model.js 617 Bytes
Newer Older
Yoon, Daeki's avatar
quiz    
Yoon, Daeki committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import mongoose from 'mongoose'

const QuizSchema = new mongoose.Schema({
  author: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: 'User'
  },
  title: String,
  score: Number,
  published: Boolean,
  created: {
    type: Date,
    default: Date.now
  },
  updated: Date,
  publishedAt: Date,
  startAt: Date,
  endAt: Date,
Yoon, Daeki's avatar
Yoon, Daeki committed
19
20
21
22
  problems: [{
    type: mongoose.SchemaTypes.ObjectId,
    ref: 'Problem'
  }], // Problem Schemas
Yoon, Daeki's avatar
quiz    
Yoon, Daeki committed
23
24
25
  image: {
    type: Buffer,
    contentType: String,
Yoon, Daeki's avatar
Yoon, Daeki committed
26
27
28
29
  },
  course: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: 'Course'
Yoon, Daeki's avatar
quiz    
Yoon, Daeki committed
30
31
32
33
  }
})

export default mongoose.model('Quiz', QuizSchema)