1234567891011121314151617181920 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 位置表
- const LocationSchema = {
- name: { type: String, required: true, maxLength: 500 }, // 名称
- type: { type: String, required: true, maxLength: 10 }, // 0、教室位置 1、开班仪式地点 2、拓展计划地点 3、用餐地点
- ibeacon: { type: String, required: false, maxLength: 500 }, // 蓝牙设备号
- };
- const schema = new Schema(LocationSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Location', schema, 'location');
- };
|