patentwarning.js 1.2 KB

12345678910111213141516171819202122232425262728293031
  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 patentwarning = {
  8. to_id: { type: ObjectId }, // 接收人id
  9. to_name: { type: String }, // 接收人姓名
  10. create_number: { type: String }, // 专利申请号
  11. patent_id: { type: ObjectId }, // 预警专利id
  12. patent_name: { type: String }, // 预警专利姓名
  13. content: { type: String }, // 预警信息
  14. file_url: { type: Array }, // 预警文件
  15. is_read: { type: Boolean, default: false }, // 是否已读
  16. remark: { type: String },
  17. };
  18. const schema = new Schema(patentwarning, { toJSON: { virtuals: true } });
  19. schema.index({ id: 1 });
  20. schema.index({ to_id: 1 });
  21. schema.index({ to_name: 1 });
  22. schema.index({ create_number: 1 });
  23. schema.index({ patent_id: 1 });
  24. schema.index({ patent_name: 1 });
  25. schema.index({ is_read: 1 });
  26. schema.index({ 'meta.createdAt': 1 });
  27. schema.plugin(metaPlugin);
  28. module.exports = app => {
  29. const { mongoose } = app;
  30. return mongoose.model('Patentwarning', schema, 'patent_warning');
  31. };