appapk.js 1.0 KB

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