'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const { Secret } = require('naf-framework-mongoose/lib/model/schema'); // 债权融资需求表 const ClaimNeedSchema = { money: { type: Number, required: true, maxLength: 200 }, // 融资金额 use: { type: String, required: true, maxLength: 100}, //融资用途 mongey_min_rate: { type: Number, maxLength: 200 }, // 期望利率范围(小) mongey_max_rate: { type: Number, maxLength: 200 }, // 期望利率范围(大) claims_min_term: { type: Number, maxLength: 500 }, // 期望融资期限(小) claims_max_term: { type: Number, maxLength: 500 }, // 期望融资期限(大) ensure_id: { type: String, required: true, maxLength: 200 }, // 担保方式(应该是担保字典ID) project_status: { type: String}, // 项目情况 remarks: { type: String}, // 备注 jg_id: { type: String, maxLength: 200 ,default:'0'}, //金融机构ID(非定向默认为:0) jg_pro_id: { type: String, maxLength: 200,default:'0'}, // 产品ID(非定向默认为:0) cdata: { type: String, maxLength: 200}, // 辅助资料(文件URL) userid: { type: String, required: true, maxLength: 200},//企业ID status: { type: String, maxLength: 200,default:'0'}//0 存在 1 删除 }; const schema = new Schema(ClaimNeedSchema, { toJSON: { virtuals: true } }); schema.index({ userid: 1 }); schema.index({ jg_id: 1 }); schema.index({ jg_pro_id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Claimneed', schema, 'claim_need'); };