class.js 1.6 KB

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 班级表
  5. const ClassSchema = {
  6. name: { type: String, required: true, maxLength: 500 }, // 班级名称
  7. number: { type: String, required: false, maxLength: 200 }, // 人数
  8. batchid: { type: String, required: false, maxLength: 200 }, // 批次
  9. termid: { type: String, required: false, maxLength: 200 }, // 期
  10. planid: { type: String, required: false, maxLength: 200 }, // 计划
  11. planyearid: { type: String, required: false, maxLength: 200 }, // 大批次id
  12. headteacherid: { type: String, required: false, maxLength: 200 }, // 班主任id
  13. lyteacherid: { type: String, required: false, maxLength: 200 }, // 礼仪课老师id
  14. rjteacherid: { type: String, required: false, maxLength: 200 }, // 日间助教老师id
  15. yclocationid: { type: String, required: false, maxLength: 200 }, // 用餐地点id
  16. kzjhlocationid: { type: String, required: false, maxLength: 200 }, // 拓展训练地点id
  17. kbyslocationid: { type: String, required: false, maxLength: 200 }, // 开班仪式地点id
  18. jslocationid: { type: String, required: false, maxLength: 200 }, // 教室位置id
  19. lessonid: { type: String, required: false, maxLength: 200 }, // 课程表id
  20. type: { type: String, required: false, maxLength: 200 }, // 类型:0-正常,1-特殊
  21. };
  22. const schema = new Schema(ClassSchema, { toJSON: { virtuals: true } });
  23. schema.index({ id: 1 });
  24. schema.plugin(metaPlugin);
  25. module.exports = app => {
  26. const { mongoose } = app;
  27. return mongoose.model('Class', schema, 'class');
  28. };