dock_vip.js 1.0 KB

123456789101112131415161718192021222324252627
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. const { Secret } = require('naf-framework-mongoose/lib/model/schema');
  7. // 展会vip表
  8. const dock_vip = {
  9. dock_id: { type: ObjectId, required: true }, // 展会id
  10. name: { type: String }, // 名称
  11. phone: { type: String, required: false, maxLength: 200 }, // 电话
  12. password: { type: Secret, select: false }, // 密码
  13. email: { type: String, required: false, maxLength: 200 }, // 邮箱
  14. brief: { type: String, required: false, maxLength: 200 }, // 简介
  15. remark: { type: String },
  16. };
  17. const schema = new Schema(dock_vip, { toJSON: { virtuals: true } });
  18. schema.index({ id: 1 });
  19. schema.index({ dock_id: 1 });
  20. schema.index({ name: 1 });
  21. schema.index({ phone: 1 });
  22. schema.index({ 'meta.createdAt': 1 });
  23. schema.plugin(metaPlugin);
  24. module.exports = app => {
  25. const { mongoose } = app;
  26. return mongoose.model('Dock_vip', schema, 'dock_vip');
  27. };