|
@@ -0,0 +1,20 @@
|
|
|
+'use strict';
|
|
|
+const Schema = require('mongoose').Schema;
|
|
|
+const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
|
|
|
+
|
|
|
+// 友情链接表
|
|
|
+const LinkSchema = {
|
|
|
+ pic: { type: String, required: true, maxLength: 500 }, // 图片路径
|
|
|
+ name: { type: String, required: true, maxLength: 500 }, // 名称
|
|
|
+ url: { type: String, required: true, maxLength: 500 }, // 链接
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+const schema = new Schema(LinkSchema, { toJSON: { virtuals: true } });
|
|
|
+schema.index({ id: 1 });
|
|
|
+schema.plugin(metaPlugin);
|
|
|
+
|
|
|
+module.exports = app => {
|
|
|
+ const { mongoose } = app;
|
|
|
+ return mongoose.model('Link', schema, 'link');
|
|
|
+};
|