expertsuser.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const { Secret } = require('naf-framework-mongoose/lib/model/schema');
  5. // 专家基本信息表
  6. const ExpertsuserSchema = {
  7. name: { type: String, required: true, maxLength: 200 }, // 专家姓名
  8. gender: { type: String, required: false, maxLength: 200 }, // 性别
  9. password: { type: Secret, required: false, select: false }, // 登录密码
  10. cardnumber: { type: String, required: false, maxLength: 500 }, // 身份证号
  11. phone: { type: String, required: true, maxLength: 200 }, // 电话号码
  12. email: { type: String, required: false, maxLength: 200 }, // 邮箱
  13. addr: { type: String, required: false, maxLength: 500 }, // 地址
  14. img_path: { type: String, required: false }, // 头像图片
  15. birthday: { type: String, required: false, maxLength: 20 }, // 出生日期
  16. level: { type: String, required: false, maxLength: 200 }, // 职称级别
  17. levelname: { type: String, required: false, maxLength: 200 }, // 职称名称
  18. position: { type: String, required: false, maxLength: 200 }, // 职务
  19. school: { type: String, required: false, maxLength: 200 }, // 院校
  20. xl: { type: String, required: false, maxLength: 200 }, // 学历
  21. xw: { type: String, required: false, maxLength: 200 }, // 学位
  22. major: { type: String, required: false, maxLength: 200 }, // 专业
  23. professional: { type: String, required: false, maxLength: 200 }, // 从事专业
  24. resume: { type: String, required: false, maxLength: 5000 }, // 工作简历
  25. project: { type: String, required: false, maxLength: 5000 }, // 项目
  26. academic: { type: String, required: false, maxLength: 5000 }, // 学术成就
  27. paper: { type: String, required: false, maxLength: 5000 }, // 论文
  28. remark: { type: String, required: false, maxLength: 5000 }, // 备注
  29. role: { type: String, required: false, maxLength: 20 }, // 角色
  30. status: { type: String, required: false, default: '0', maxLength: 200 }, // 审核状态,0-注册,1-通过,2-拒绝
  31. pid: { type: String, required: false }, // 父id
  32. deptname: { type: String, required: false }, // 机构名称
  33. userid: { type: String, required: false }, // 用户表主键id
  34. code: { type: String, required: false }, // 邀请码
  35. };
  36. const schema = new Schema(ExpertsuserSchema, { toJSON: { virtuals: true } });
  37. schema.index({ id: 1 });
  38. schema.plugin(metaPlugin);
  39. module.exports = app => {
  40. const { mongoose } = app;
  41. return mongoose.model('Expertsuser', schema, 'experts_user');
  42. };