uploadtask.js 1.3 KB

123456789101112131415161718192021222324252627282930313233
  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. studentid: { type: String, required: true, maxLength: 200 }, // 学生id
  17. picrul: { type: String, required: false, maxLength: 200 }, // 上传图片地址
  18. taskid: { type: String, required: false, maxLength: 200 }, // 作业id
  19. score: { type: String, required: false, maxLength: 2000 }, // 分数
  20. answers: { type: [ answerInfo ], select: true }, // 回答详情
  21. };
  22. const schema = new Schema(UploadtaskSchema, { toJSON: { virtuals: true } });
  23. schema.index({ id: 1 });
  24. schema.plugin(metaPlugin);
  25. module.exports = app => {
  26. const { mongoose } = app;
  27. return mongoose.model('Uploadtask', schema, 'uploadtask');
  28. };