1234567891011121314151617181920212223242526272829303132333435 |
- '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
- topic: { type: String, required: false, maxLength: 200 }, // 问题
- answer: { type: String, required: false, maxLength: 200 }, // 答案
- questionscore: { type: String, required: false, maxLength: 200 }, // 分数
- });
- // 学生上传作业表
- const UploadtaskSchema = {
- termid: { type: String, required: true, maxLength: 200 }, // 期id
- batchid: { type: String, required: true, maxLength: 200 }, // 批次id
- classid: { type: String, required: true, maxLength: 200 }, // 班级id
- lessonid: { type: String, required: true, maxLength: 200 }, // 课程信息id
- lessonname: { type: String, required: false, maxLength: 200 }, // 课程信息名称
- studentid: { type: String, required: true, maxLength: 200 }, // 学生id
- picurl: { type: Array, required: false, maxLength: 200 }, // 上传图片地址
- taskid: { type: String, required: false, maxLength: 200 }, // 作业id
- score: { type: String, required: false, maxLength: 2000 }, // 分数
- answers: { type: [ answerInfo ], select: true }, // 回答详情
- };
- const schema = new Schema(UploadtaskSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Uploadtask', schema, 'uploadtask');
- };
|