expert.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "use strict";
  2. const Schema = require("mongoose").Schema;
  3. const moment = require("moment");
  4. const metaPlugin = require("naf-framework-mongoose-free/lib/model/meta-plugin");
  5. const { Secret } = require("naf-framework-mongoose-free/lib/model/schema");
  6. const { ObjectId } = require("mongoose").Types;
  7. // 专家表
  8. const expert = {
  9. name: { type: String, required: true }, // 用户名
  10. phone: { type: String, required: false, maxLength: 200 }, // 电话号码
  11. password: { type: Secret, required: true, select: false }, // 登录密码
  12. code: { type: String, required: false, default: "INVESTORS" }, // 邀请码
  13. role: { type: String, required: false, default: "5" }, // 角色
  14. email: { type: String, required: false, maxLength: 200 }, // 邮箱
  15. addr: { type: String, required: false, maxLength: 500 }, // 地址
  16. office_phone: { type: String, required: false, maxLength: 500 }, // 办公电话
  17. profession: { type: String, required: false, maxLength: 500 }, // 所属行业
  18. juris: { type: String }, // 辖区
  19. card: { type: String, required: false, maxLength: 200 }, // 身份证号
  20. birthDate: { type: String, required: false, maxLength: 500 }, // 出生日期
  21. qqwx: { type: String, required: false, maxLength: 500 }, // qq&微信
  22. school: { type: String, required: false, maxLength: 500 }, // 所在院校
  23. education: { type: String, required: false, maxLength: 500 }, // 最高学历
  24. major: { type: String, required: false, maxLength: 200 }, // 所学专业
  25. company: { type: String, required: false, maxLength: 500 }, // 单位名称
  26. zwzc: { type: String, required: false, maxLength: 500 }, // 职务职称
  27. img_path: { type: Array, required: false }, // 头像图片
  28. expertise: { type: String, required: false, maxLength: 500 }, // 擅长领域
  29. workexperience: { type: String, required: false, maxLength: 500 }, // 工作经历
  30. scientific: { type: String, required: false, maxLength: 500 }, // 科研综述
  31. undertakingproject: { type: String, required: false, maxLength: 500 }, // 承担项目
  32. scienceaward: { type: String, required: false, maxLength: 500 }, // 科技奖励
  33. social: { type: String, required: false, maxLength: 500 }, // 社会任职
  34. personal_id: { type: String, required: false, maxLength: 500 }, // 升级专家个人用户关联id
  35. status: { type: String, required: false, default: "0", maxLength: 500 }, // 审核状态,0-注册,1-通过,2-拒绝
  36. openid: { type: String, required: false }, // 微信openid
  37. isdel: { type: String, required: false, default: "0" }, // 0=>未删除;1=>已删除
  38. remark: { type: String, maxLength: 200 },
  39. create_time: { type: String },
  40. };
  41. const schema = new Schema(expert, { toJSON: { virtuals: true } });
  42. schema.index({ id: 1 });
  43. schema.index({ name: 1 });
  44. schema.index({ phone: 1 });
  45. schema.index({ code: 1 });
  46. schema.index({ status: 1 });
  47. schema.index({ "meta.createdAt": 1 });
  48. schema.plugin(metaPlugin);
  49. module.exports = (app) => {
  50. const { mongoose } = app;
  51. return mongoose.model("Expert", schema, "expert");
  52. };