|
@@ -0,0 +1,31 @@
|
|
|
|
+'use strict';
|
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+// 信息表
|
|
|
|
+const ThousandSchema = {
|
|
|
|
+ title: { type: String, required: false, maxLength: 128 }, // 标题
|
|
|
|
+ pic: { type: String, required: false, maxLength: 256 }, // 标题图片URL
|
|
|
|
+ content: { type: String, required: false, maxLength: 102400, select: false }, // 内容详情
|
|
|
|
+ abstract: { type: String, required: false, maxLength: 500 }, // 内容简介
|
|
|
|
+ type: { type: String, required: false, maxLength: 5 }, // 所属类型
|
|
|
|
+ parent_id: { type: String, required: false, maxLength: 64 }, // 所属id
|
|
|
|
+ parent: { type: String, required: false, maxLength: 100 }, // 所属名称
|
|
|
|
+ publish_time: String, // 发布时间
|
|
|
|
+ url: { type: String, required: false, maxLength: 256 }, // 外部链接
|
|
|
|
+ info_type: { type: String, required: false, maxLength: 256, default: '0' }, // 信息类型 0、普通 1、外链
|
|
|
|
+ is_use: { type: String, required: false, maxLength: 5 }, // 是否使用,0=>使用中;1=>已禁止
|
|
|
|
+ news_type: { type: String, default: 1, maxLength: 5 }, // 0抓取,1正常输入
|
|
|
|
+ origin: { type: String, required: false, maxLength: 200 }, // 发布来源
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+const schema = new Schema(ThousandSchema, { toJSON: { virtuals: true } });
|
|
|
|
+schema.index({ id: 1 });
|
|
|
|
+schema.plugin(metaPlugin);
|
|
|
|
+
|
|
|
|
+module.exports = app => {
|
|
|
|
+ const { mongoose } = app;
|
|
|
|
+ return mongoose.model('Thousand', schema, 'market_thousand');
|
|
|
|
+};
|