serviceContact.js 822 B

12345678910111213141516171819202122
  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. shop: { type: String, required: false, zh: '店铺id' }, //
  7. phone: { type: String, required: false, zh: '联系电话' }, //
  8. wx: { type: String, required: false, zh: '微信' }, //
  9. qq: { type: String, required: false, zh: 'QQ' }, //
  10. email: { type: String, required: false, zh: '邮箱' }, //
  11. };
  12. const schema = new Schema(serviceContact, { toJSON: { getters: true, virtuals: true } });
  13. schema.index({ id: 1 });
  14. schema.index({ 'meta.createdAt': 1 });
  15. schema.index({ shop: 1 });
  16. schema.plugin(metaPlugin);
  17. module.exports = app => {
  18. const { mongoose } = app;
  19. return mongoose.model('ServiceContact ', schema, 'serviceContact ');
  20. };