|
@@ -1,19 +1,19 @@
|
|
-"use strict";
|
|
|
|
-const Schema = require("mongoose").Schema;
|
|
|
|
-const metaPlugin = require("naf-framework-mongoose/lib/model/meta-plugin");
|
|
|
|
|
|
+'use strict';
|
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
|
|
|
// 热点资讯表
|
|
// 热点资讯表
|
|
-const links = {
|
|
|
|
|
|
+const linksSchema = {
|
|
name: { type: String, required: true, maxLength: 200 }, // 名称
|
|
name: { type: String, required: true, maxLength: 200 }, // 名称
|
|
- linkurl: { type: String, required: false, maxLength: 200 }, // 链接地址
|
|
|
|
- create_time: { type: String, required: false, maxLength: 200 }, // 发布时间
|
|
|
|
|
|
+ linkurl: { type: String, required: true, maxLength: 800 }, // 链接地址
|
|
|
|
+ create_time: { type: String, required: true, maxLength: 200 }, // 发布时间
|
|
};
|
|
};
|
|
|
|
|
|
-const schema = new Schema(links, { toJSON: { virtuals: true } });
|
|
|
|
|
|
+const schema = new Schema(linksSchema, { toJSON: { virtuals: true } });
|
|
schema.index({ id: 1 });
|
|
schema.index({ id: 1 });
|
|
schema.plugin(metaPlugin);
|
|
schema.plugin(metaPlugin);
|
|
|
|
|
|
-module.exports = (app) => {
|
|
|
|
|
|
+module.exports = app => {
|
|
const { mongoose } = app;
|
|
const { mongoose } = app;
|
|
- return mongoose.model("Links", schema, "links");
|
|
|
|
|
|
+ return mongoose.model('Links', schema, 'links');
|
|
};
|
|
};
|