|
@@ -4,31 +4,35 @@ const moment = require('moment');
|
|
|
const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
|
|
|
const { Secret } = require('naf-framework-mongoose-free/lib/model/schema');
|
|
|
const { ObjectId } = require('mongoose').Types;
|
|
|
-// 文件链接
|
|
|
-const filelinks = new Schema({
|
|
|
- title: { type: String, required: false, maxLength: 500 }, // 名称,
|
|
|
- url: { type: String, required: false, maxLength: 500 }, // 链接地址,
|
|
|
-});
|
|
|
+
|
|
|
// 信息表
|
|
|
const news = {
|
|
|
- user_id: { type: ObjectId },
|
|
|
- column_id: { type: String, required: false, maxLength: 500 }, // 栏目id
|
|
|
- column_name: { type: String, required: false, maxLength: 500 }, // 栏目名称
|
|
|
- title: { type: String, required: false, maxLength: 500 }, // 标题
|
|
|
- publish_time: { type: String, required: false, maxLength: 500 }, // 时间
|
|
|
- origin: { type: String, required: false, maxLength: 500, default: '网站管理员' }, // 来源
|
|
|
- brief: { type: String, maxLength: 300 }, // 简介
|
|
|
- picture: { type: Object, required: false }, // 图片
|
|
|
- filepath: { type: Object, required: false }, // 附件
|
|
|
- video: { type: Object }, // 视频
|
|
|
- content: { type: String, required: false }, // 正文内容
|
|
|
- type: { type: String, required: false, maxLength: 200 }, // 类型,国家,科学院
|
|
|
+ column_id: { type: String, required: false, default: "" }, //栏目id
|
|
|
+ column_name: { type: String, required: false, default: "" }, //栏目名称
|
|
|
+ title: { type: String, required: false, default: "" }, //信息标题
|
|
|
+ type: { type: String, required: false, default: "" }, //信息类型,国家,科学院
|
|
|
+ release_time: { type: String, required: false, default: "" }, //发布时间
|
|
|
+ origin: { type: String, required: false, default: "网站管理员" }, //信息来源
|
|
|
+ brief: { type: String, required: false, default: "" }, //信息简介
|
|
|
+ img_url: { type: Array, required: false, default: "" }, //图片文件
|
|
|
+ video_url: { type: Array, required: false, default: "" }, //视频文件
|
|
|
+ file_url: { type: Array, required: false, default: "" }, //附件文件
|
|
|
+ content: { type: String, required: false, default: "" }, //信息内容
|
|
|
+ is_money: { type: String, required: false, default: "" }, //是否收费
|
|
|
+ money_url: { type: Array, required: false, default: "" }, //收费图片
|
|
|
+ dock_id: { type: String, required: false, default: "" }, //展会id
|
|
|
+ is_use: { type: String, required: false, default: "" }, //是否禁用
|
|
|
+ user_id: { type: String, required: false, default: "" }, //用户id
|
|
|
remark: { type: String, maxLength: 200 },
|
|
|
create_time: { type: String },
|
|
|
};
|
|
|
const schema = new Schema(news, { toJSON: { virtuals: true } });
|
|
|
schema.index({ id: 1 });
|
|
|
-schema.index({ title: 1 });
|
|
|
+schema.index({ column_id: 1 });
|
|
|
+schema.index({ type: 1 });
|
|
|
+schema.index({ dock_id: 1 });
|
|
|
+schema.index({ is_use: 1 });
|
|
|
+schema.index({ user_id: 1 });
|
|
|
schema.index({ 'meta.createdAt': 1 });
|
|
|
schema.plugin(metaPlugin);
|
|
|
module.exports = app => {
|