trainmodel.js 1.1 KB

12345678910111213141516171819202122232425
  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. batchnum: { type: String, required: false, maxLength: 200 }, // 默认期下生成的批次数
  11. classnum: { type: String, required: false, maxLength: 200 }, // 默认批次下生成的班级数
  12. stunum: { type: String, required: false, maxLength: 200 }, // 默认每班学生数
  13. carpnum: { type: String, required: false, maxLength: 200 }, // 默认每辆车的学生数
  14. };
  15. const schema = new Schema(TrainmodelSchema, { toJSON: { virtuals: true } });
  16. schema.index({ id: 1 });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('Trainmodel', schema, 'trainmodel');
  21. };