schtime.js 1.5 KB

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