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