answer_tea.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. const { Secret } = require('naf-framework-mongoose/lib/model/schema');
  7. // 咨询师表
  8. const answer_tea = {
  9. name: { type: String }, // 姓名
  10. phone: { type: String }, // 手机号
  11. password: { type: Secret, select: false }, // 密码
  12. card: { type: String }, // 身份证号
  13. email: { type: String }, // 电子邮箱
  14. address: { type: String }, // 地址
  15. zwzc: { type: String }, // 职务职称
  16. school: { type: String }, // 院校
  17. major: { type: String }, // 专业
  18. word_tel: { type: String }, // 办公电话
  19. type: { type: String }, // 用户类型:1-咨询师;2-代理师;3-分析师
  20. role: { type: String, default: '5' }, // 角色
  21. remark: { type: String },
  22. };
  23. const schema = new Schema(answer_tea, { toJSON: { virtuals: true } });
  24. schema.index({ id: 1 });
  25. schema.index({ name: 1 });
  26. schema.index({ phone: 1 });
  27. schema.index({ card: 1 });
  28. schema.index({ email: 1 });
  29. schema.index({ address: 1 });
  30. schema.index({ zwzc: 1 });
  31. schema.index({ school: 1 });
  32. schema.index({ major: 1 });
  33. schema.index({ word_tel: 1 });
  34. schema.index({ type: 1 });
  35. schema.index({ role: 1 });
  36. schema.index({ 'meta.createdAt': 1 });
  37. schema.plugin(metaPlugin);
  38. module.exports = (app) => {
  39. const { mongoose } = app;
  40. return mongoose.model('AnswerTea', schema, 'answer_tea');
  41. };