expert.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 { Secret } = require('naf-framework-mongoose/lib/model/schema');
  6. const { ObjectId } = require('mongoose').Types;
  7. // 专家表
  8. const expert = {
  9. user_id: { type: ObjectId }, // 关联的personal的id
  10. education: { type: String, required: false, maxLength: 500 }, // 最高学历
  11. school: { type: String, required: false, maxLength: 500 }, // 毕业院校
  12. birthDate: { type: String, required: false, maxLength: 500 }, // 出生日期
  13. qqwx: { type: String, required: false, maxLength: 500 }, // qq&微信
  14. email: { type: String, required: false, maxLength: 500 }, // 邮箱
  15. company: { type: String, required: false, maxLength: 500 }, // 单位名称
  16. zwzc: { type: String, required: false, maxLength: 500 }, // 职务职称
  17. expertise: { type: String, required: false, maxLength: 500 }, // 擅长领域
  18. img_path: { type: String, required: false }, // 头像图片
  19. workexperience: { type: String, required: false, maxLength: 500 }, // 工作经历
  20. scientific: { type: String, required: false, maxLength: 500 }, // 科研综述
  21. undertakingproject: { type: String, required: false, maxLength: 500 }, // 承担项目
  22. scienceaward: { type: String, required: false, maxLength: 500 }, // 科技奖励
  23. social: { type: String, required: false, maxLength: 500 }, // 社会任职
  24. status: { type: String, required: false, default: '0', maxLength: 500 }, // 审核状态,0-注册,1-通过,2-拒绝
  25. major: { type: String, required: false, maxLength: 200 }, // 专业
  26. card: { type: String, required: false, maxLength: 200 }, // 身份证号
  27. isdel: { type: String, required: false, default: '0' }, // 0=>未删除;1=>已删除
  28. remark: { type: String, maxLength: 200 },
  29. create_time: {
  30. type: String,
  31. default: moment().format('YYYY-MM-DD HH:mm:ss'),
  32. },
  33. };
  34. const schema = new Schema(expert, { toJSON: { virtuals: true } });
  35. schema.index({ id: 1 });
  36. schema.index({ phone: 1 });
  37. schema.index({ code: 1 });
  38. schema.index({ status: 1 });
  39. schema.index({ 'meta.createdAt': 1 });
  40. schema.plugin(metaPlugin);
  41. module.exports = app => {
  42. const { mongoose } = app;
  43. return mongoose.model('Expert', schema, 'expert');
  44. };