'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 InstitutionSchema = { uid: { type: String, required: true, maxLength: 200 }, // 金融机构用户id name: { type: String, required: true, maxLength: 200 }, // 机构名称 logo: { type: String, required: false, maxLength: 200 }, // 机构logo type: { type: String, required: false, maxLength: 500 }, // 机构类型,0-能发布债权产品,1-能发布股权产品,2-既能发布债权产品又能发布股权产品 profession: { type: [ String ], required: false, maxLength: 5000 }, // 行业 round: { type: [ String ], required: false, maxLength: 5000 }, // 融资轮次 form: { type: String, required: false, maxLength: 200 }, // 组织形式 representative: { type: String, required: false, maxLength: 200 }, // 法定代表人 business_addr: { type: String, required: false, maxLength: 200 }, // 办公地址 belong_addr: { type: String, required: false, maxLength: 200 }, // 所属地区 registered_addr: { type: String, required: false, maxLength: 200 }, // 注册地址 establish_time: { type: String, required: false, maxLength: 200 }, // 创立时间 introduction: { type: String, required: false }, // 机构简介 code: { type: String, required: false, maxLength: 200 }, // 组织机构号码 size: { type: String, required: false, maxLength: 200 }, // 管理资金规模 registered_capital: { type: String, required: false, maxLength: 200 }, // 注册资本 contributed_capital: { type: String, required: false, maxLength: 200 }, // 实缴资金 status: { type: String, required: true, maxLength: 500, default: '0' }, // 发布状态,0-草稿,1-待审核,2-已发布,3-已下架 }; const schema = new Schema(InstitutionSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ uid: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Institution', schema, 'institution'); };