serviceContact.js 734 B

123456789101112131415161718192021
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  4. // 联系客服
  5. const serviceContact = {
  6. phone: { type: String, required: false, zh: '联系电话' }, //
  7. wx: { type: String, required: false, zh: '微信' }, //
  8. qq: { type: String, required: false, zh: 'QQ' }, //
  9. email: { type: String, required: false, zh: '邮箱' }, //
  10. };
  11. const schema = new Schema(serviceContact, { toJSON: { getters: true, virtuals: true } });
  12. schema.index({ id: 1 });
  13. schema.index({ 'meta.createdAt': 1 });
  14. schema.plugin(metaPlugin);
  15. module.exports = app => {
  16. const { mongoose } = app;
  17. return mongoose.model('ServiceContact ', schema, 'serviceContact ');
  18. };