investigation.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 企业调查
  5. const investigation = {
  6. name: { type: String, required: true }, // 企业名称
  7. address: { type: String, required: false }, // 通讯地址
  8. postal: { type: String, required: false }, // 邮编
  9. web_site: { type: String, required: false }, // 网址
  10. register_type: { type: Array, required: false }, // 注册登记类型
  11. field: { type: Array, required: false }, // 所属领域
  12. register_time: { type: String, required: false }, // 注册时间
  13. funds: { type: String, required: false }, // 注册资金
  14. register_address: { type: String, required: false }, // 注册地
  15. brief: { type: String, required: false }, // 企业概况
  16. legal_person: { type: Object, required: false }, // 法人信息
  17. person_number: { type: String, required: false }, // 职工人数
  18. bk_number: { type: String, required: false }, // 本科以上人数
  19. research_number: { type: String, required: false }, // 研究开发人数
  20. advanced_number: { type: String, required: false }, // 高级职称人数
  21. contact: { type: String, required: false }, // 联系人
  22. contact_tel: { type: String, required: false }, // 联系电话
  23. email: { type: String, required: false }, // 电子邮箱
  24. qq: { type: String, required: false }, // qq
  25. products: { type: Array, required: false }, // 产品列表
  26. requirement: { type: Object, required: false }, // 企业需求情况
  27. // 2021-11-14
  28. techol_name: { type: String, required: false }, // 需求名称
  29. urgent: { type: String, required: false }, // 紧急程度
  30. cooperation: { type: Array, required: false }, // 合作方式
  31. budget: { type: String, required: false }, // 投资预算
  32. };
  33. const schema = new Schema(investigation, { toJSON: { virtuals: true } });
  34. schema.index({ id: 1 });
  35. schema.index({ 'meta.createdAt': 1 });
  36. schema.index({ name: 1 });
  37. schema.index({ field: 1 });
  38. schema.index({ register_time: 1 });
  39. schema.index({ register_type: 1 });
  40. schema.index({ contact_tel: 1 });
  41. schema.plugin(metaPlugin);
  42. module.exports = app => {
  43. const { mongoose } = app;
  44. return mongoose.model('Investigation', schema, 'investigation');
  45. };