question.model.ts 522 Bytes
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
1
import { model, ObjectId, Schema, Types } from "mongoose";
Jiwon Yoon's avatar
Jiwon Yoon committed
2
3

export interface IQuestion {
Jiwon Yoon's avatar
Jiwon Yoon committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  _id?: Types.ObjectId;
  type: string;
  title?: string;
  isRequired: boolean;
  comment?: string;
  content?: any;
}

const schema = new Schema<IQuestion>(
  {
    type: { type: String },
    title: { type: String },
    isRequired: { type: Boolean },
    comment: { type: String },
    content: { type: Object },
  },
  {
    toJSON: {
      versionKey: false,
    },
Jiwon Yoon's avatar
Jiwon Yoon committed
24
  }
Jiwon Yoon's avatar
Jiwon Yoon committed
25
26
27
);

export default model<IQuestion>("Question", schema);