import type { Model } from 'mongoose'; import { Schema } from 'mongoose'; import { getOrCreateModel } from '~/server/util/mongoose-utils'; import type { IProactiveQuestionnaireAnswer } from '../../interfaces/proactive-questionnaire-answer'; import { growiInfoSchema } from './schema/growi-info'; import { userInfoSchema } from './schema/user-info'; interface ProactiveQuestionnaireAnswerDocument extends IProactiveQuestionnaireAnswer, Document {} type ProactiveQuestionnaireAnswerModel = Model export const proactiveQuestionnaireAnswerSchema = new Schema({ satisfaction: { type: Number, required: true }, lengthOfExperience: { type: String }, position: { type: String }, occupation: { type: String }, commentText: { type: String, required: true }, growiInfo: { type: growiInfoSchema, required: true }, userInfo: { type: userInfoSchema, required: true }, answeredAt: { type: Date }, }, { timestamps: true }); export default getOrCreateModel( 'ProactiveQuestionnaireAnswer', proactiveQuestionnaireAnswerSchema, );