trainmodel.js 1.0 KB

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