123456789101112131415161718192021222324252627282930313233 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 答案详情
- const answerInfo = new Schema({
- questionid: { type: String, required: false, maxLength: 200 }, // 问题id
- answer: { type: String, required: false, maxLength: 200 }, // 答案
- });
- // 学生上传问卷表
- const UploadquestionSchema = {
- planid: { type: String, required: true, maxLength: 200 }, // 计划id
- termid: { type: String, required: true, maxLength: 200 }, // 期id
- batchid: { type: String, required: true, maxLength: 200 }, // 批次id
- classid: { type: String, required: true, maxLength: 200 }, // 班级id
- studentid: { type: String, required: true, maxLength: 200 }, // 学生id
- questionnaireid: { type: String, required: false, maxLength: 200 }, // 问卷id
- answers: { type: [ answerInfo ], select: true }, // 选项
- };
- const schema = new Schema(UploadquestionSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ termid: 1 });
- schema.index({ batchid: 1 });
- schema.index({ classid: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Uploadquestion', schema, 'uploadquestion');
- };
|