quiz.model.js 478 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
19
20
21
22
23
24
25
26
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,
  questions: [], // Question Schemas
  image: {
    type: Buffer,
    contentType: String,
  }
})

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