location.js 722 B

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