trainmodel.js 1.2 KB

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 全年计划模板表
  5. const TrainmodelSchema = {
  6. total: { type: String, required: false, maxLength: 200 }, // 总人数
  7. day: { type: String, required: false, maxLength: 200 }, // 课程所需天数
  8. color: { type: [ String ], required: false }, // 默认颜色
  9. planyearid: { type: String, required: true, maxLength: 200 }, // 大批次id
  10. planid: { type: String, required: true, maxLength: 200 }, // 计划id
  11. batchnum: { type: String, required: false, maxLength: 200 }, // 默认期下生成的批次数
  12. classnum: { type: String, required: false, maxLength: 200 }, // 默认批次下生成的班级数
  13. stunum: { type: String, required: false, maxLength: 200 }, // 默认每班学生数
  14. carpnum: { type: String, required: false, maxLength: 200 }, // 默认每辆车的学生数
  15. };
  16. const schema = new Schema(TrainmodelSchema, { toJSON: { virtuals: true } });
  17. schema.index({ id: 1 });
  18. schema.plugin(metaPlugin);
  19. module.exports = app => {
  20. const { mongoose } = app;
  21. return mongoose.model('Trainmodel', schema, 'trainmodel');
  22. };