patent.js 1.5 KB

123456789101112131415161718192021222324252627282930313233
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const { ObjectId } = require('mongoose').Types;
  5. // 专利表
  6. const PatentSchema = {
  7. create_number: { type: String, required: false }, // 申请号
  8. create_date: { type: String, required: false }, // 申请日
  9. success_number: { type: String, required: false }, // 公开(公告)号
  10. success_date: { type: String, required: false }, // 公开(公告)日
  11. name: { type: String, required: false }, // 标题
  12. inventor: { type: String, required: false }, // 发明人
  13. address: { type: String, required: false }, // 发明人地址
  14. apply_personal: { type: String, required: false }, // 申请人
  15. term: { type: String, required: false }, // 专利有效性
  16. type: { type: String, required: false }, // 专利类型
  17. agent_personal: { type: String, required: false }, // 代理人
  18. agent: { type: String, required: false }, // 代理机构
  19. abstract: { type: String, required: false }, // 摘要
  20. img_url: { type: String, required: false }, // 图片
  21. origin: { type: String }, // 数据来源(手写的)
  22. user_id: { type: [ ObjectId ] },
  23. };
  24. const schema = new Schema(PatentSchema, { toJSON: { virtuals: true } });
  25. schema.index({ id: 1 });
  26. schema.index({ 'meta.createdAt': 1 });
  27. schema.plugin(metaPlugin);
  28. module.exports = app => {
  29. const { mongoose } = app;
  30. return mongoose.model('Patent', schema, 'patent');
  31. };