'use strict'; const Schema = require('mongoose').Schema; const moment = require('moment'); const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); const { ObjectId } = require('mongoose').Types; // 专利运营专利申请预警表 const patentwarning = { to_id: { type: ObjectId }, // 接收人id to_name: { type: String }, // 接收人姓名 create_number: { type: String }, // 专利申请号 patent_id: { type: ObjectId }, // 预警专利id patent_name: { type: String }, // 预警专利姓名 content: { type: String }, // 预警信息 file_url: { type: Array }, // 预警文件 is_read: { type: Boolean, default: false }, // 是否已读 remark: { type: String }, }; const schema = new Schema(patentwarning, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ to_id: 1 }); schema.index({ to_name: 1 }); schema.index({ create_number: 1 }); schema.index({ patent_id: 1 }); schema.index({ patent_name: 1 }); schema.index({ is_read: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Patentwarning', schema, 'patent_warning'); };