'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 financeInfo = new Schema({ report_time: { type: String, required: false, maxLength: 200 }, // 财务报告时间 status: { type: String, required: false, maxLength: 64 }, // 上传状态 upload_time: { type: String, required: false, maxLength: 200 }, // 上传时间 url: { type: String, required: false, maxLength: 200 }, // 上传链接 }); // 上传信息详情 const urlInfo = new Schema({ name: { type: String, required: false, maxLength: 200 }, // 资料名称 url: { type: String, required: false, maxLength: 500 }, // 资料链接 }); // 其他信息表 const otherInfo = new Schema({ info_name: { type: String, required: false, maxLength: 200 }, // 资料名称 remark: { type: String, required: false, maxLength: 500 }, // 资料说明 url_info: { type: [ urlInfo ], select: true }, // 上传信息 }); // 企业信息表 const CompanySchema = { uid: { type: String, required: true, maxLength: 200 }, // 关联企业用户id company_name: { type: String, required: true, maxLength: 200 }, // 企业名称 registered_addr: { type: String, required: false, maxLength: 500 }, // 工商注册地址 business_addr: { type: String, required: false, maxLength: 500 }, // 实际经营地址 profession_one: { type: String, required: false, maxLength: 200 }, // 所属一级行业 profession_two: { type: String, required: false, maxLength: 200 }, // 所属二级行业 profession_three: { type: String, required: false, maxLength: 200 }, // 所属三级行业 profession_four: { type: String, required: false, maxLength: 200 }, // 所属四级行业 contacts: { type: String, required: false, maxLength: 200 }, // 融资联系人 contact_number: { type: String, required: false, maxLength: 200 }, // 联系人手机 contact_position: { type: String, required: false, maxLength: 200 }, // 联系人职位 contact_email: { type: String, required: false, maxLength: 200 }, // 联系人邮箱 telephone: { type: String, required: false, maxLength: 200 }, // 固定电话 finance_info: { type: [ financeInfo ], select: true }, // 财务信息 other_info: { type: [ otherInfo ], select: true }, // 其他信息 }; const schema = new Schema(CompanySchema, { toJSON: { virtuals: true } }); schema.index({ uid: 1 }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Company', schema, 'company'); };