'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); // 公司信息 const company = { name: { type: String, required: false, zh: '公司名称' }, // logo_url: { type: Array, required: false, zh: '公司logo' }, // address: { type: String, required: false, zh: '公司地址' }, // contact: { type: String, required: false, zh: '联系人' }, // phone: { type: String, required: false, zh: '联系电话' }, // qq: { type: String, required: false, zh: 'qq' }, // email: { type: String, required: false, zh: '电子邮箱' }, // mobile: { type: String, required: false, zh: '座机' }, // advantage: { type: Array, required: false, zh: '公司优势' }, // programme: { type: Array, required: false, zh: '解决方案' }, // idea: { type: String, required: false, zh: '品牌理念' }, // unique: { type: String, required: false, zh: '独特优势' }, // join: { type: String, required: false, zh: '加入我们' }, // }; const schema = new Schema(company, { toJSON: { getters: true, virtuals: true } }); schema.index({ id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.index({ name: 1 }); schema.index({ address: 1 }); schema.index({ contact: 1 }); schema.index({ phone: 1 }); schema.index({ qq: 1 }); schema.index({ email: 1 }); schema.index({ mobile: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Company', schema, 'company'); };