bedroom.js 961 B

123456789101112131415161718192021222324
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 寝室表
  5. const BedroomSchema = {
  6. code: { type: String, required: true, maxLength: 200 }, // 寝室号
  7. number: { type: String, required: true, maxLength: 200 }, // 人数
  8. batch: { type: String, required: false, maxLength: 200 }, // 批次
  9. gender: { type: String, required: false, maxLength: 200 }, // 男女限制
  10. floor: { type: String, required: false, maxLength: 200 }, // 楼层
  11. ibeacon: { type: String, required: false, maxLength: 500 }, // 蓝牙设备号
  12. status: { type: String, required: false, maxLength: 200, default: '0' }, // 状态:0-启用,1-停用
  13. };
  14. const schema = new Schema(BedroomSchema, { toJSON: { virtuals: true } });
  15. schema.index({ id: 1 });
  16. schema.plugin(metaPlugin);
  17. module.exports = app => {
  18. const { mongoose } = app;
  19. return mongoose.model('Bedroom', schema, 'bedroom');
  20. };