productpact.js 1.3 KB

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 科技超市产品合同表
  5. const ProductpactSchema = {
  6. dockid: { type: String, required: false, maxLength: 500 }, // 对接id
  7. product_id: { type: String, required: true, maxLength: 500 }, // 产品ID
  8. product_name: { type: String, required: false, maxLength: 500 }, // 产品名称
  9. description: { type: String, required: false }, // 描述
  10. userid: { type: String, required: true, maxLength: 500 }, // 购买人ID
  11. username: { type: String, required: false, maxLength: 500 }, // 购买人名称
  12. market_userid: { type: String, required: true, maxLength: 500 }, // 营销人ID
  13. market_username: { type: String, required: false, maxLength: 500 }, // 营销人名称
  14. transaction_id: { type: String, required: true, maxLength: 500 }, // 交易主表ID
  15. status: { type: String, required: false, maxLength: 200, default: '0' }, // 状态(0:待审核 1:通过审核)
  16. };
  17. const schema = new Schema(ProductpactSchema, { toJSON: { virtuals: true } });
  18. schema.index({ id: 1 });
  19. schema.index({ product_id: 1 });
  20. schema.plugin(metaPlugin);
  21. module.exports = app => {
  22. const { mongoose } = app;
  23. return mongoose.model('Productpact', schema, 'market_product_pact');
  24. };