company.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 financeInfo = new Schema({
  7. report_time: { type: String, required: false, maxLength: 200 }, // 财务报告时间
  8. status: { type: String, required: false, maxLength: 64 }, // 上传状态
  9. upload_time: { type: String, required: false, maxLength: 200 }, // 上传时间
  10. url: { type: String, required: false, maxLength: 200 }, // 上传链接
  11. });
  12. // 上传信息详情
  13. const urlInfo = new Schema({
  14. name: { type: String, required: false, maxLength: 200 }, // 资料名称
  15. url: { type: String, required: false, maxLength: 500 }, // 资料链接
  16. });
  17. // 其他信息表
  18. const otherInfo = new Schema({
  19. info_name: { type: String, required: false, maxLength: 200 }, // 资料名称
  20. remark: { type: String, required: false, maxLength: 500 }, // 资料说明
  21. url_info: { type: [ urlInfo ], select: true }, // 上传信息
  22. });
  23. // 企业信息表
  24. const CompanySchema = {
  25. uid: { type: String, required: true, maxLength: 200 }, // 关联企业用户id
  26. company_name: { type: String, required: true, maxLength: 200 }, // 企业名称
  27. registered_addr: { type: String, required: false, maxLength: 500 }, // 工商注册地址
  28. business_addr: { type: String, required: false, maxLength: 500 }, // 实际经营地址
  29. profession_one: { type: String, required: false, maxLength: 200 }, // 所属一级行业
  30. profession_two: { type: String, required: false, maxLength: 200 }, // 所属二级行业
  31. profession_three: { type: String, required: false, maxLength: 200 }, // 所属三级行业
  32. profession_four: { type: String, required: false, maxLength: 200 }, // 所属四级行业
  33. contacts: { type: String, required: false, maxLength: 200 }, // 融资联系人
  34. contact_number: { type: String, required: false, maxLength: 200 }, // 联系人手机
  35. contact_position: { type: String, required: false, maxLength: 200 }, // 联系人职位
  36. contact_email: { type: String, required: false, maxLength: 200 }, // 联系人邮箱
  37. telephone: { type: String, required: false, maxLength: 200 }, // 固定电话
  38. finance_info: { type: [ financeInfo ], select: true }, // 财务信息
  39. other_info: { type: [ otherInfo ], select: true }, // 其他信息
  40. };
  41. const schema = new Schema(CompanySchema, { toJSON: { virtuals: true } });
  42. schema.index({ uid: 1 });
  43. schema.index({ id: 1 });
  44. schema.plugin(metaPlugin);
  45. module.exports = app => {
  46. const { mongoose } = app;
  47. return mongoose.model('Company', schema, 'company');
  48. };