problem.model.js 679 Bytes
Newer Older
Yoon, Daeki's avatar
quiz    
Yoon, Daeki committed
1
2
import mongoose from 'mongoose'

Yoon, Daeki's avatar
Yoon, Daeki committed
3
const ProblemSchema = new mongoose.Schema({
Yoon, Daeki's avatar
Yoon, Daeki committed
4
5
6
7
  author: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: 'User'
  },
Yoon, Daeki's avatar
Yoon, Daeki committed
8
9
10
11
  quiz: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: 'Quiz'
  },
Yoon, Daeki's avatar
quiz    
Yoon, Daeki committed
12
13
14
15
16
17
18
19
20
  type: String, // 객관식, 주관식 single/multiple choice
  created: {
    type: Date,
    default: Date.now
  },
  updated: Date,
  level: String,
  category: [String],
  score: Number, //문제당 할당 점수
Yoon, Daeki's avatar
Yoon, Daeki committed
21
22
  question: String, //질문
  answers: [String], // 선택형 항목
Yoon, Daeki's avatar
quiz    
Yoon, Daeki committed
23
24
25
26
27
28
  correct: {
    type: mongoose.Schema.Types.ObjectId,
    ref: 'Answer'
  }, // 정답; Answer Model 객체
})

Yoon, Daeki's avatar
Yoon, Daeki committed
29
export default mongoose.model('Problem', ProblemSchema)