1234567891011121314151617181920212223242526 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- // 专利运营已授权专利预警表
- const patentearly = {
- parent_id: { type: ObjectId }, // 专利id
- name: { type: String }, // 专利名称
- inventor: { type: String }, // 发明人
- lose_date: { type: String }, // 失效日
- content: { type: String }, // 预警消息
- user_id: { type: [ ObjectId ] }, // 接收人id
- remark: { type: String },
- };
- const schema = new Schema(patentearly, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ parent_id: 1 });
- schema.index({ name: 1 });
- schema.index({ inventor: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Patentearly', schema, 'patent_early');
- };
|