apply.js 718 B

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