apply.js 801 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 ApplySchema = {
  6. termid: { type: String, required: true, maxLength: 200 }, // 申请期id
  7. subid: { type: String, required: true, maxLength: 200 }, // 科目id
  8. date: { type: String, required: true, maxLength: 200 }, // 申请上课的日期
  9. teacherid: { type: String, required: true, maxLength: 200 }, // 教师id
  10. reason: { type: String, required: false, maxLength: 2000 }, // 申请原因
  11. };
  12. const schema = new Schema(ApplySchema, { toJSON: { virtuals: true } });
  13. schema.index({ id: 1 });
  14. schema.plugin(metaPlugin);
  15. module.exports = app => {
  16. const { mongoose } = app;
  17. return mongoose.model('Apply', schema, 'apply');
  18. };