123456789101112131415161718192021222324252627282930 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- // 热门链接
- const hotlink = {
- place: { type: String, required: false, zh: '展示位置' }, //
- title: { type: String, required: false, zh: '名称' }, //
- origin: { type: String, required: false, default: '系统管理员', zh: '来源' }, //
- create_time: { type: String, required: false, zh: '时间' }, //
- img_url: { type: Array, required: false, zh: '图片' }, //
- web_url: { type: String, required: false, zh: '平台网址' }, //
- is_use: { type: String, required: false, default: '0', zh: '是否启用' }, //
- };
- const schema = new Schema(hotlink, { toJSON: { getters: true, virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.index({ place: 1 });
- schema.index({ title: 1 });
- schema.index({ origin: 1 });
- schema.index({ create_time: 1 });
- schema.index({ web_url: 1 });
- schema.index({ is_use: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Hotlink', schema, 'hotlink');
- };
|