patentanalysis.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 查新检索-交底单
  7. const patentanalysis = {
  8. user_id: { type: ObjectId }, // 用户id
  9. user_name: { type: String }, // 用户姓名
  10. admin_id: { type: ObjectId }, // 管理员id
  11. admin_name: { type: String }, // 管理员姓名
  12. name: { type: String }, // 发明名称
  13. apply_name: { type: String }, // 申请人
  14. type: { type: String }, // 专利类型
  15. inventor: { type: String }, // 发明人
  16. contact: { type: String }, // 联系人
  17. phone: { type: String }, // 联系人电话
  18. email: { type: String }, // 联系人邮箱
  19. questions: { type: Object, default: {} }, // 问题
  20. file: { type: Array }, // 报告文件
  21. status: { type: String, default: "0" }, // 状态
  22. record: { type: Array }, // 记录
  23. remark: { type: String },
  24. };
  25. const schema = new Schema(patentanalysis, { toJSON: { virtuals: true } });
  26. schema.index({ id: 1 });
  27. schema.index({ user_id: 1 });
  28. schema.index({ admin_id: 1 });
  29. schema.index({ name: 1 });
  30. schema.index({ status: 1 });
  31. schema.index({ 'meta.createdAt': 1 });
  32. schema.plugin(metaPlugin);
  33. module.exports = app => {
  34. const { mongoose } = app;
  35. return mongoose.model('Patentanalysis', schema, 'patent_analysis');
  36. };