patent.js 1.4 KB

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