schtime.js 1.1 KB

1234567891011121314151617181920212223242526272829
  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. });
  10. // 培训计划学校上报时间表
  11. const SchtimeSchema = {
  12. schid: { type: String, required: true, maxLength: 500 }, // 学校id
  13. year: { type: String, required: false, maxLength: 200 }, // 年份
  14. planid: { type: String, requiredl: false, maxLength: 200 }, // 培训计划表id
  15. remark: { type: String, requiredl: false, maxLength: 500 }, // 备注
  16. term: { type: [ termInfo ], select: true }, // 期
  17. };
  18. const schema = new Schema(SchtimeSchema, { toJSON: { virtuals: true } });
  19. schema.index({ id: 1 });
  20. schema.plugin(metaPlugin);
  21. module.exports = app => {
  22. const { mongoose } = app;
  23. return mongoose.model('Schtime', schema, 'schtime');
  24. };