dock_user.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/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 展会用户表
  7. const dock_user = {
  8. dock_id: { type: ObjectId, required: true }, // 展会id
  9. user_id: { type: ObjectId }, // 申请人
  10. name: { type: String }, // 名称
  11. phone: { type: String, required: false, maxLength: 200 }, // 电话
  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('Dock_user', schema, 'dock_user');
  30. };