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

export interface ISurvey {
Jiwon Yoon's avatar
Jiwon Yoon committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  title?: string;
  comment?: string;
  // userId: Types.ObjectId;
  questions: Types.ObjectId[];
}

const schema = new Schema<ISurvey>({
  title: { type: String },
  comment: { type: String },
  // userId: { type: Schema.Types.ObjectId, ref: "User" },
  questions: [{ type: Schema.Types.ObjectId, ref: "Question" }],
});

export default model<ISurvey>("Survey", schema);