classtype.js 872 B

12345678910111213141516171819202122
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 班级类型表
  5. const ClasstypeSchema = {
  6. name: { type: String, required: true, maxLength: 500 }, // 班级类型名称
  7. code: { type: String, required: false, maxLength: 200 }, // 班级类型代码(自定义)
  8. bedroom: { type: String, required: false, maxLength: 200 }, // 0分配;1填写 寝室
  9. sign: { type: String, required: false, maxLength: 200 }, // 0学生签到;1教师签到
  10. hascar: { type: String, required: false, maxLength: 500 }, // 是否派车,0-否,1-是
  11. };
  12. const schema = new Schema(ClasstypeSchema, { toJSON: { virtuals: true } });
  13. schema.index({ id: 1 });
  14. schema.plugin(metaPlugin);
  15. module.exports = app => {
  16. const { mongoose } = app;
  17. return mongoose.model('Classtype', schema, 'classtype');
  18. };