score.js 769 B

12345678910111213141516171819202122
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 评分表
  5. const ScoreSchema = {
  6. lessonid: { type: String, required: true, maxLength: 200 }, // 课程id
  7. stuid: { type: String, required: true, maxLength: 200 }, // 学生id
  8. teacherid: { type: String, required: true, maxLength: 200 }, // 教师id
  9. score: { type: String, required: false, maxLength: 200 }, // 评分
  10. remark: { type: String, required: false, maxLength: 2000 }, // 评价
  11. };
  12. const schema = new Schema(ScoreSchema, { toJSON: { virtuals: true } });
  13. schema.index({ id: 1 });
  14. schema.plugin(metaPlugin);
  15. module.exports = app => {
  16. const { mongoose } = app;
  17. return mongoose.model('Score', schema, 'score');
  18. };