dock.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const apply = new Schema({
  5. user_id: { type: String, required: true, maxLength: 200 }, // 用户id
  6. user_name: { type: String, required: true, maxLength: 200 }, // 用户名称
  7. buyer: { type: String, required: true, maxLength: 1 }, // 买家/卖家 0/1
  8. goodsList: [Object],
  9. contact: { type: String, required: true, maxLength: 200 }, // 联系人
  10. contact_tel: { type: String, required: true, maxLength: 200 }, // 联系人电话
  11. email: { type: String, maxLength: 200 }, // 邮箱
  12. company: { type: String, maxLength: 200 }, // 单位名称
  13. apply_time: { type: String, maxLength: 200 }, // 申请时间
  14. role: { type: String, maxLength: 200 }, // 申请人类型
  15. status: { type: String, default: 0, maxLength: 1 }, // 申请状态 (0未审核;1已通过;2已拒绝)
  16. });
  17. apply.index({ id: 1 });
  18. apply.index({ userid: 1 });
  19. const Dock = {
  20. title: { type: String, required: true, maxLength: 200 }, // 对接会标题
  21. desc: { type: String, maxLength: 1000 }, // 简介
  22. status: { type: String, default: "0", maxLength: 1 }, // 状态:0准备中;1已开始;2已结束
  23. start_time: { type: String, required: true, maxLength: 200 }, // 开始时间
  24. end_time: { type: String, required: true, maxLength: 200 }, // 结束时间
  25. join_end: { type: String, required: true, maxLength: 200 }, // 报名截止时间
  26. apply: { type: [apply], default: [] },
  27. is_allowed: { type: String, default: "0", maxLength: 1 }, // 0未审核;1已允许;2已拒绝
  28. reason: { type: String, required: false, maxLength: 200 }, // 拒绝理由
  29. user_id: { type: String, required: true, maxLength: 200 }, // 申请用户
  30. province: { type: String, required: false }, // 省
  31. file_path: { type: String, required: false }, // 视频路径
  32. place: { type: String, required: false }, // 位置
  33. roomname: { type: String, required: false }, // 房间号
  34. u_id: { type: String, required: false, maxLength: 200 }, // 所属用户
  35. };
  36. const schema = new Schema(Dock, { toJSON: { virtuals: true } });
  37. schema.index({ id: 1 });
  38. schema.plugin(metaPlugin);
  39. module.exports = app => {
  40. const { mongoose } = app;
  41. return mongoose.model('dock', schema, 'dock');
  42. };