|
@@ -0,0 +1,24 @@
|
|
|
|
+'use strict';
|
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
|
+
|
|
|
|
+// 信息表
|
|
|
|
+const NewsSchema = {
|
|
|
|
+ column_id: { type: String, required: false, maxLength: 500 }, // 栏目id
|
|
|
|
+ column_name: { type: String, required: false, maxLength: 500 }, // 栏目名称
|
|
|
|
+ title: { type: String, required: false, maxLength: 500 }, // 标题
|
|
|
|
+ orgin: { type: String, required: false, maxLength: 500 }, // 来源
|
|
|
|
+ publish: { type: String, required: false, maxLength: 500 }, // 发布者
|
|
|
|
+ content: { type: String, required: false }, // 正文
|
|
|
|
+ picture: { type: String, required: false }, // 图片路径
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+const schema = new Schema(NewsSchema, { toJSON: { virtuals: true } });
|
|
|
|
+schema.index({ id: 1 });
|
|
|
|
+schema.plugin(metaPlugin);
|
|
|
|
+
|
|
|
|
+module.exports = app => {
|
|
|
|
+ const { mongoose } = app;
|
|
|
|
+ return mongoose.model('News', schema, 'live_news');
|
|
|
|
+};
|