123456789101112131415161718192021222324252627 |
- '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 patentnotice = {
- send_id: { type: ObjectId }, // 发送人id
- send_name: { type: String }, // 发送人姓名
- to_type: { type: String }, // 0-所有人;1-机构用户;2-平台用户;3机构发给自己用户
- to_id: { type: [ ObjectId ] }, // 接收人id
- content: { type: String }, // 内容
- remark: { type: String },
- };
- const schema = new Schema(patentnotice, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ send_id: 1 });
- schema.index({ send_name: 1 });
- schema.index({ to_type: 1 });
- schema.index({ to_id: 1 });
- schema.index({ is_read: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Patentnotice', schema, 'patent_notice');
- };
|