|
@@ -0,0 +1,29 @@
|
|
|
|
+'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 dimension = {
|
|
|
|
+ user_id: { type: ObjectId }, //
|
|
|
|
+ title: { type: String }, // 标题
|
|
|
|
+ publish_time: { type: String }, // 时间
|
|
|
|
+ origin: { type: String, default: '网站管理员' }, // 来源
|
|
|
|
+ brief: { type: String }, // 简介
|
|
|
|
+ is_show: { type: Boolean, default: false }, // 是否展示
|
|
|
|
+ filepath: { type: Object }, // 附件
|
|
|
|
+ content: { type: String }, // 正文内容
|
|
|
|
+ remark: { type: String },
|
|
|
|
+ create_time: { type: String }, // 创建时间
|
|
|
|
+};
|
|
|
|
+const schema = new Schema(dimension, { toJSON: { virtuals: true } });
|
|
|
|
+schema.index({ id: 1 });
|
|
|
|
+schema.index({ title: 1 });
|
|
|
|
+schema.index({ publish_time: 1 });
|
|
|
|
+schema.index({ origin: 1 });
|
|
|
|
+schema.index({ 'meta.createdAt': 1 });
|
|
|
|
+schema.plugin(metaPlugin);
|
|
|
|
+module.exports = app => {
|
|
|
|
+ const { mongoose } = app;
|
|
|
|
+ return mongoose.model('Dimension', schema, 'dimension');
|
|
|
|
+};
|