dockTranscation.js 1.3 KB

123456789101112131415161718192021222324252627282930313233
  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_transcation = {
  8. dock_id: { type: String }, // 展会id
  9. product_id: { type: String }, // 产品id
  10. product_name: { type: String }, // 产品名称
  11. s_id: { type: String }, // 供给者id
  12. s_name: { type: String }, // 供给者姓名
  13. s_phone: { type: String }, // 供给者电话
  14. d_id: { type: String }, // 需求者id
  15. d_name: { type: String }, // 需求者姓名
  16. d_phone: { type: String }, // 需求者电话
  17. status: { type: String, default: "0" }, // 0-正在洽谈,1-达成意向,2-交易备案,3-交易完成,4-交易失败
  18. contact: { type: Array }, // 合同文件
  19. remark: { type: String },
  20. };
  21. const schema = new Schema(dock_transcation, { toJSON: { virtuals: true } });
  22. schema.index({ id: 1 });
  23. schema.index({ dock_id: 1 });
  24. schema.index({ product_id: 1 });
  25. schema.index({ s_id: 1 });
  26. schema.index({ d_id: 1 });
  27. schema.index({ status: 1 });
  28. schema.index({ 'meta.createdAt': 1 });
  29. schema.plugin(metaPlugin);
  30. module.exports = app => {
  31. const { mongoose } = app;
  32. return mongoose.model('DockTranscation', schema, 'dockTranscation');
  33. };