class.js 1.4 KB

1234567891011121314151617181920212223242526272829
  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. jslocationid: { type: String, required: false, maxLength: 200 }, // 教室位置id
  16. lessonid: { type: String, required: false, maxLength: 200 }, // 课程表id
  17. type: { type: String, required: false, maxLength: 200 }, // 类型:0-正常,1-特殊
  18. };
  19. const schema = new Schema(ClassSchema, { toJSON: { virtuals: true } });
  20. schema.index({ id: 1 });
  21. schema.plugin(metaPlugin);
  22. module.exports = app => {
  23. const { mongoose } = app;
  24. return mongoose.model('Class', schema, 'class');
  25. };