patentapply.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 专利申请-审批单
  7. const patentapply = {
  8. user_id: { type: ObjectId }, // 用户id
  9. admin_id: { type: ObjectId }, // 管理员id
  10. is_mech: { type: String }, // 是否需要机构
  11. mechanism_id: { type: ObjectId }, // 机构id
  12. mechanism_name: { type: String }, // 机构名称
  13. water_number: { type: String }, // 流水号
  14. create_number: { type: String }, // 申请号
  15. name: { type: String }, // 发明名称
  16. apply_name: { type: String }, // 申请人
  17. type: { type: String }, // 申请类型
  18. inventor: { type: Array }, // 发明人
  19. contact: { type: Array }, // 联系人
  20. phone: { type: String }, // 联系人电话
  21. email: { type: String }, // 联系人邮箱
  22. questions: { type: Object }, // 问题
  23. check_url: { type: Array }, // 审查文件
  24. agent_url: { type: Array }, // 专利代理上报文件
  25. record: { type: Array }, // 记录
  26. status: { type: String, default: '0' }, // 状态
  27. remark: { type: String },
  28. };
  29. const schema = new Schema(patentapply, { toJSON: { virtuals: true } });
  30. schema.index({ id: 1 });
  31. schema.index({ user_id: 1 });
  32. schema.index({ admin_id: 1 });
  33. schema.index({ is_mech: 1 });
  34. schema.index({ mechanism_id: 1 });
  35. schema.index({ mechanism_name: 1 });
  36. schema.index({ water_number: 1 });
  37. schema.index({ create_number: 1 });
  38. schema.index({ name: 1 });
  39. schema.index({ apply_name: 1 });
  40. schema.index({ status: 1 });
  41. schema.index({ 'meta.createdAt': 1 });
  42. schema.plugin(metaPlugin);
  43. module.exports = app => {
  44. const { mongoose } = app;
  45. return mongoose.model('Patentapply', schema, 'patent_apply');
  46. };