'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const { Secret } = require('naf-framework-mongoose/lib/model/schema'); // 企业联系人信息表 const ContactsSchema = { uid: { type: String, required: true, maxLength: 200 }, // 关联企业用户id name: { type: String, required: true, maxLength: 200 }, // 联系人姓名 position: { type: String, required: true, maxLength: 200 }, // 职位 gender: { type: String, required: true, maxLength: 200 }, // 性别 email: { type: String, required: true, maxLength: 200 }, // 电子邮箱 telephone: { type: String, required: true, maxLength: 200 }, // 固定电话 phone: { type: String, required: true, maxLength: 200 }, // 常用手机 contact_addr_city: { type: String, required: true, maxLength: 200 }, // 联系地址-市 contact_addr_area: { type: String, required: true, maxLength: 200 }, // 联系地址-区 detail_addr: { type: String, required: true, maxLength: 200 }, // 详细地址 }; const schema = new Schema(ContactsSchema, { toJSON: { virtuals: true } }); schema.index({ uid: 1 }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Contacts', schema, 'contacts'); };