123456789101112131415161718192021222324252627282930313233 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- // 表
- const dock_transcation = {
- dock_id: { type: String }, // 展会id
- product_id: { type: String }, // 产品id
- product_name: { type: String }, // 产品名称
- s_id: { type: String }, // 供给者id
- s_name: { type: String }, // 供给者姓名
- s_phone: { type: String }, // 供给者电话
- d_id: { type: String }, // 需求者id
- d_name: { type: String }, // 需求者姓名
- d_phone: { type: String }, // 需求者电话
- status: { type: String, default: "0" }, // 0-正在洽谈,1-达成意向,2-交易备案,3-交易完成,4-交易失败
- contact: { type: Array }, // 合同文件
- remark: { type: String },
- };
- const schema = new Schema(dock_transcation, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ dock_id: 1 });
- schema.index({ product_id: 1 });
- schema.index({ s_id: 1 });
- schema.index({ d_id: 1 });
- schema.index({ status: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('DockTranscation', schema, 'dockTranscation');
- };
|