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

3
export interface IAnswer {
Jiwon Yoon's avatar
Jiwon Yoon committed
4
5
6
  _id?: Types.ObjectId;
  surveyId?: Types.ObjectId;
  questionId?: Types.ObjectId;
7
  guestId?: string;
8
  content?: any;
Jiwon Yoon's avatar
Jiwon Yoon committed
9
10
}

11
const schema = new Schema<IAnswer>(
Jiwon Yoon's avatar
Jiwon Yoon committed
12
13
14
  {
    surveyId: { type: Schema.Types.ObjectId, ref: "Survey" },
    questionId: { type: Schema.Types.ObjectId, ref: "Question" },
15
    guestId: { type: String },
16
    content: { type: Object },
Jiwon Yoon's avatar
Jiwon Yoon committed
17
18
19
20
  },
  { timestamps: true }
);

21
export default model<IAnswer>("Answer", schema);