class.js 1.3 KB

12345678910111213141516171819202122232425262728
  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. headteacherid: { type: String, required: false, maxLength: 200 }, // 班主任id
  11. lyteacherid: { type: String, required: false, maxLength: 200 }, // 礼仪课老师id
  12. yclocationid: { type: String, required: false, maxLength: 200 }, // 用餐地点id
  13. kzjhlocationid: { type: String, required: false, maxLength: 200 }, // 扩展计划地点id
  14. kbyslocationid: { type: String, required: false, maxLength: 200 }, // 开班仪式地点id
  15. lessonid: { type: String, required: false, maxLength: 200 }, // 课程表id
  16. type: { type: String, required: false, maxLength: 200 }, // 类型:0-正常,1-特殊
  17. };
  18. const schema = new Schema(ClassSchema, { toJSON: { virtuals: true } });
  19. schema.index({ id: 1 });
  20. schema.plugin(metaPlugin);
  21. module.exports = app => {
  22. const { mongoose } = app;
  23. return mongoose.model('Class', schema, 'class');
  24. };