appbanner.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  4. // app轮播图
  5. const appbanner = {
  6. place: { type: String, required: false, zh: '展示位置' }, //
  7. title: { type: String, required: false, zh: '名称' }, //
  8. origin: { type: String, required: false, default: '系统管理员', zh: '来源' }, //
  9. create_time: { type: String, required: false, zh: '时间' }, //
  10. img_url: { type: Array, required: false, zh: '图片' }, //
  11. web_url: { type: String, required: false, zh: '平台网址' }, //
  12. is_use: { type: String, required: false, default: '0', zh: '是否启用' }, //
  13. };
  14. const schema = new Schema(appbanner, { toJSON: { getters: true, virtuals: true } });
  15. schema.index({ id: 1 });
  16. schema.index({ 'meta.createdAt': 1 });
  17. schema.index({ place: 1 });
  18. schema.index({ title: 1 });
  19. schema.index({ origin: 1 });
  20. schema.index({ create_time: 1 });
  21. schema.index({ web_url: 1 });
  22. schema.index({ is_use: 1 });
  23. schema.plugin(metaPlugin);
  24. module.exports = app => {
  25. const { mongoose } = app;
  26. return mongoose.model('Appbanner', schema, 'appbanner');
  27. };