schtime.js 1.4 KB

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