patentanalysis.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 patentanalysis = {
  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. name: { type: String }, // 发明名称
  14. apply_name: { type: String }, // 申请人
  15. type: { type: String }, // 申请类型
  16. inventer: { type: String }, // 发明人
  17. contact: { type: String }, // 联系人
  18. phone: { type: String }, // 联系人电话
  19. email: { type: String }, // 联系人邮箱
  20. questions: { type: Object }, // 问题
  21. file: { type: Array }, // 报告文件
  22. record: { type: Array }, // 记录
  23. status: { type: String, default: '0' }, // 状态
  24. remark: { type: String },
  25. };
  26. const schema = new Schema(patentanalysis, { toJSON: { virtuals: true } });
  27. schema.index({ id: 1 });
  28. schema.index({ user_id: 1 });
  29. schema.index({ admin_id: 1 });
  30. schema.index({ is_mech: 1 });
  31. schema.index({ mechanism_id: 1 });
  32. schema.index({ mechanism_name: 1 });
  33. schema.index({ name: 1 });
  34. schema.index({ apply_name: 1 });
  35. schema.index({ status: 1 });
  36. schema.index({ 'meta.createdAt': 1 });
  37. schema.plugin(metaPlugin);
  38. module.exports = app => {
  39. const { mongoose } = app;
  40. return mongoose.model('Patentanalysis', schema, 'patent_analysis');
  41. };