dock_user.js 1.3 KB

12345678910111213141516171819202122232425262728
  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 { Secret } = require('naf-framework-mongoose/lib/model/schema');
  6. const { ObjectId } = require('mongoose').Types;
  7. // 展会-用户表
  8. const dockUser = {
  9. dock_id: { type: ObjectId }, // 展会id
  10. user_id: { type: ObjectId, required: true }, // 用户id
  11. user_name: { type: String, required: true, maxLength: 200 }, // 用户名称
  12. goodsList: { type: [ Object ], default: [] }, // 产品列表
  13. contact_tel: { type: String, required: false, maxLength: 200 }, // 联系人电话
  14. apply_time: { type: String, maxLength: 200 }, // 申请时间
  15. // role: { type: String, maxLength: 200 }, // 申请人类型
  16. status: { type: String, default: '0', maxLength: 1 }, // 申请状态 (0未审核;1已通过;2已拒绝)
  17. remark: { type: String, maxLength: 200 },
  18. create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') },
  19. };
  20. const schema = new Schema(dockUser, { toJSON: { virtuals: true } });
  21. schema.index({ id: 1 });
  22. schema.index({ dock_id: 1 });
  23. schema.index({ status: 1 });
  24. schema.plugin(metaPlugin);
  25. module.exports = app => {
  26. const { mongoose } = app;
  27. return mongoose.model('Dock_user', schema, 'dock_user');
  28. };