schtime.js 1.4 KB

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