1234567891011121314151617181920212223242526272829303132 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- // app轮播图
- const appbanner = {
- 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(appbanner, { 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('Appbanner', schema, 'appbanner');
- };
|