schtime.js 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const termInfo = new Schema({
  5. termnum: { type: String, required: false, maxLength: 200 }, // 期数
  6. termid: { type: String, required: false, maxLength: 200 }, // 期id
  7. number: { type: String, required: false, maxLength: 200 }, // 人数
  8. type: { type: String, required: false, maxLength: 200 }, // 类别
  9. carnum: { type: String, required: false, maxLength: 200 }, // 派车数量
  10. });
  11. // 培训计划学校上报时间表
  12. const SchtimeSchema = {
  13. schid: { type: String, required: true, maxLength: 500 }, // 学校id
  14. year: { type: String, required: false, maxLength: 200 }, // 年份
  15. planid: { type: String, required: false, maxLength: 200 }, // 培训计划表id
  16. remark: { type: String, required: false, maxLength: 500 }, // 备注
  17. daterange: { type: [ String ], required: false, maxLength: 500 }, // 学校可以上课时间
  18. // 此字段不需要暂时先保留
  19. term: { type: [ termInfo ], select: true }, // 期
  20. };
  21. const schema = new Schema(SchtimeSchema, { toJSON: { virtuals: true } });
  22. schema.index({ id: 1 });
  23. schema.plugin(metaPlugin);
  24. module.exports = app => {
  25. const { mongoose } = app;
  26. return mongoose.model('Schtime', schema, 'schtime');
  27. };