investigation.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. field: { type: Array, required: false }, // 所属领域
  10. funds: { type: String, required: false }, // 注册资金
  11. register_time: { type: String, required: false }, // 注册时间
  12. web_site: { type: String, required: false }, // 网址
  13. legal_person: { type: Object, required: false }, // 法人信息
  14. register_type: { type: Array, required: false }, // 注册登记类型
  15. contact: { type: String, required: false }, // 联系人
  16. contact_tel: { type: String, required: false }, // 联系电话
  17. email: { type: String, required: false }, // 电子邮箱
  18. person_number: { type: String, required: false }, // 职工人数
  19. bk_number: { type: String, required: false }, // 本科以上人数
  20. research_number: { type: String, required: false }, // 研究开发人数
  21. advanced_number: { type: String, required: false }, // 高级职称人数
  22. brief: { type: String, required: false }, // 企业概况
  23. products: { type: Array, required: false }, // 产品列表
  24. requirement: { type: Object, required: false }, // 企业需求情况
  25. };
  26. const schema = new Schema(investigation, { toJSON: { virtuals: true } });
  27. schema.index({ id: 1 });
  28. schema.index({ 'meta.createdAt': 1 });
  29. schema.index({ name: 1 });
  30. schema.index({ field: 1 });
  31. schema.index({ register_time: 1 });
  32. schema.index({ register_type: 1 });
  33. schema.index({ contact_tel: 1 });
  34. schema.plugin(metaPlugin);
  35. module.exports = app => {
  36. const { mongoose } = app;
  37. return mongoose.model('Investigation', schema, 'investigation');
  38. };