uploadtask.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 答案详情
  5. const answerInfo = new Schema({
  6. questionid: { type: String, required: false, maxLength: 200 }, // 问题id
  7. answer: { type: String, required: false, maxLength: 200 }, // 答案
  8. questionscore: { type: String, required: false, maxLength: 200 }, // 分数
  9. });
  10. // 学生上传作业表
  11. const UploadtaskSchema = {
  12. termid: { type: String, required: true, maxLength: 200 }, // 期id
  13. batchid: { type: String, required: true, maxLength: 200 }, // 批次id
  14. classid: { type: String, required: true, maxLength: 200 }, // 班级id
  15. lessonid: { type: String, required: true, maxLength: 200 }, // 课程信息id
  16. lessonname: { type: String, required: false, maxLength: 200 }, // 课程信息名称
  17. studentid: { type: String, required: true, maxLength: 200 }, // 学生id
  18. picrul: { type: String, required: false, maxLength: 200 }, // 上传图片地址
  19. taskid: { type: String, required: false, maxLength: 200 }, // 作业id
  20. score: { type: String, required: false, maxLength: 2000 }, // 分数
  21. answers: { type: [ answerInfo ], select: true }, // 回答详情
  22. };
  23. const schema = new Schema(UploadtaskSchema, { toJSON: { virtuals: true } });
  24. schema.index({ id: 1 });
  25. schema.plugin(metaPlugin);
  26. module.exports = app => {
  27. const { mongoose } = app;
  28. return mongoose.model('Uploadtask', schema, 'uploadtask');
  29. };