patentearly.js 951 B

1234567891011121314151617181920212223242526
  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 patentearly = {
  8. parent_id: { type: ObjectId }, // 专利id
  9. name: { type: String }, // 专利名称
  10. inventor: { type: String }, // 发明人
  11. lose_date: { type: String }, // 失效日
  12. content: { type: String }, // 预警消息
  13. user_id: { type: [ ObjectId ] }, // 接收人id
  14. remark: { type: String },
  15. };
  16. const schema = new Schema(patentearly, { toJSON: { virtuals: true } });
  17. schema.index({ id: 1 });
  18. schema.index({ parent_id: 1 });
  19. schema.index({ name: 1 });
  20. schema.index({ inventor: 1 });
  21. schema.index({ 'meta.createdAt': 1 });
  22. schema.plugin(metaPlugin);
  23. module.exports = app => {
  24. const { mongoose } = app;
  25. return mongoose.model('Patentearly', schema, 'patent_early');
  26. };