'use strict'; const Schema = require('mongoose').Schema; const moment = require('moment'); const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const { ObjectId } = require('mongoose').Types; const { Secret } = require('naf-framework-mongoose/lib/model/schema'); // 咨询师表 const answer_tea = { name: { type: String }, // 姓名 phone: { type: String }, // 手机号 password: { type: Secret, select: false }, // 密码 card: { type: String }, // 身份证号 email: { type: String }, // 电子邮箱 address: { type: String }, // 地址 zwzc: { type: String }, // 职务职称 school: { type: String }, // 院校 major: { type: String }, // 专业 word_tel: { type: String }, // 办公电话 type: { type: String }, // 用户类型:1-咨询师;2-代理师;3-分析师 role: { type: String, default: '5' }, // 角色 remark: { type: String }, }; const schema = new Schema(answer_tea, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ name: 1 }); schema.index({ phone: 1 }); schema.index({ card: 1 }); schema.index({ email: 1 }); schema.index({ address: 1 }); schema.index({ zwzc: 1 }); schema.index({ school: 1 }); schema.index({ major: 1 }); schema.index({ word_tel: 1 }); schema.index({ type: 1 }); schema.index({ role: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = (app) => { const { mongoose } = app; return mongoose.model('AnswerTea', schema, 'answer_tea'); };