'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); const configProp = { logo: { type: Array, zh: 'logo' }, share: { type: Array, zh: '分享图片' }, buyPoint: { type: Number, zh: '购物赠送积分' }, // 金额 / buyPoint 为实际获得积分 pointPlan: { type: Array, zh: '积分计划' }, // 后续有待制作,目前全靠新写 }; // 系统设置 const config = { title: { type: String, required: false, zh: '系统名称' }, // config: { type: Object, required: false, zh: '设置' }, // }; const schema = new Schema(config, { toJSON: { getters: true, virtuals: true } }); schema.index({ id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Config', schema, 'config'); };