class.js 1.5 KB

12345678910111213141516171819202122232425262728293031
  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. yclocationid: { type: String, required: false, maxLength: 200 }, // 用餐地点id
  15. kzjhlocationid: { type: String, required: false, maxLength: 200 }, // 拓展计划地点id
  16. kbyslocationid: { type: String, required: false, maxLength: 200 }, // 开班仪式地点id
  17. jslocationid: { type: String, required: false, maxLength: 200 }, // 教室位置id
  18. lessonid: { type: String, required: false, maxLength: 200 }, // 课程表id
  19. type: { type: String, required: false, maxLength: 200 }, // 类型:0-正常,1-特殊
  20. };
  21. const schema = new Schema(ClassSchema, { toJSON: { virtuals: true } });
  22. schema.index({ id: 1 });
  23. schema.plugin(metaPlugin);
  24. module.exports = app => {
  25. const { mongoose } = app;
  26. return mongoose.model('Class', schema, 'class');
  27. };