import { type ObjectId, Schema, model, Model } from 'mongoose'; export interface FormResponseI extends Document{ form: ObjectId; response: { elementType: string; question: string; answer: any; }[]; } interface FormResponseModelI extends Model {} const formResponseSchema = new Schema( { form: { type: Schema.ObjectId, ref: 'Form', required: true, }, response: [ { elementType: String, question: String, answer: Schema.Types.Mixed, }, ], }, { timestamps: true, } ); const formResponseModel = model('FormResponse', formResponseSchema); export default formResponseModel;