dockUser.js 1.1 KB

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 展会用户表
  7. const dock_user = {
  8. dock_id: { type: String }, // 展会id
  9. user_id: { type: String }, // 用户id
  10. user_name: { type: String }, // 用户姓名
  11. user_phone: { type: String }, // 用户电话
  12. create_time: { type: String }, // 申请时间
  13. productList: { type: Array }, // 参展项目
  14. status: { type: String, default: '0' }, // 0-待审核;1-审核通过;-1-审核拒绝
  15. remark: { type: String },
  16. };
  17. const schema = new Schema(dock_user, { 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({ status: 1 });
  23. schema.index({ user_id: 1 });
  24. schema.index({ create_time: 1 });
  25. schema.index({ 'meta.createdAt': 1 });
  26. schema.plugin(metaPlugin);
  27. module.exports = app => {
  28. const { mongoose } = app;
  29. return mongoose.model('DockUser', schema, 'dockUser');
  30. };