institution.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const { Secret } = require('naf-framework-mongoose/lib/model/schema');
  5. // 金融机构信息表
  6. const InstitutionSchema = {
  7. uid: { type: String, required: true, maxLength: 200 }, // 金融机构用户id
  8. name: { type: String, required: true, maxLength: 200 }, // 机构名称
  9. logo: { type: String, required: false, maxLength: 200 }, // 机构logo
  10. type: { type: String, required: false, maxLength: 500 }, // 机构类型,0-能发布债权产品,1-能发布股权产品,2-既能发布债权产品又能发布股权产品
  11. profession: { type: [ String ], required: false, maxLength: 5000 }, // 行业
  12. round: { type: [ String ], required: false, maxLength: 5000 }, // 融资轮次
  13. form: { type: String, required: false, maxLength: 200 }, // 组织形式
  14. representative: { type: String, required: false, maxLength: 200 }, // 法定代表人
  15. business_addr: { type: String, required: false, maxLength: 200 }, // 办公地址
  16. belong_addr: { type: String, required: false, maxLength: 200 }, // 所属地区
  17. registered_addr: { type: String, required: false, maxLength: 200 }, // 注册地址
  18. establish_time: { type: String, required: false, maxLength: 200 }, // 创立时间
  19. introduction: { type: String, required: false }, // 机构简介
  20. code: { type: String, required: false, maxLength: 200 }, // 组织机构号码
  21. size: { type: String, required: false, maxLength: 200 }, // 管理资金规模
  22. registered_capital: { type: String, required: false, maxLength: 200 }, // 注册资本
  23. contributed_capital: { type: String, required: false, maxLength: 200 }, // 实缴资金
  24. status: { type: String, required: true, maxLength: 500, default: '0' }, // 发布状态,0-草稿,1-待审核,2-已发布,3-已下架
  25. };
  26. const schema = new Schema(InstitutionSchema, { toJSON: { virtuals: true } });
  27. schema.index({ id: 1 });
  28. schema.index({ uid: 1 });
  29. schema.plugin(metaPlugin);
  30. module.exports = app => {
  31. const { mongoose } = app;
  32. return mongoose.model('Institution', schema, 'institution');
  33. };