question.db.ts 399 Bytes
Newer Older
Jiwon Yoon's avatar
Jiwon Yoon committed
1
2
3
4
import { Question, IQuestion } from "../models";

export const createQuestion = async (question: IQuestion) => {
  const newQuestion = await Question.create(question);
Jiwon Yoon's avatar
Jiwon Yoon committed
5
6
7
8
9
10
11
12
13
  const newQ = {
    _id: newQuestion._id,
    type: newQuestion.type,
    title: newQuestion.title,
    isRequired: newQuestion.isRequired,
    comment: newQuestion.comment,
    content: newQuestion.content,
  }
  return newQ;
Jiwon Yoon's avatar
Jiwon Yoon committed
14
};