'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 notice = { to: { type: ObjectId }, // 接收人 content: { type: String }, // 内容 is_read: { type: Boolean, default: false }, // 是否已读 remark: { type: String }, }; const schema = new Schema(notice, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ to: 1 }); schema.index({ is_read: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('DisclosureNotice', schema, 'disclosure_notice'); };