achieve_expert.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  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. // 使用手机号密码登录
  9. const achieve_expert = {
  10. expert_user_id: { type: ObjectId }, // 专家的用户id
  11. expert_name: { type: String }, // 专家姓名
  12. phone: { type: String }, // 电话/登陆用
  13. company: { type: String }, // 工作单位
  14. group_zw: { type: String }, // 评价专家组职务
  15. major: { type: String }, // 所学专业
  16. now_major: { type: String }, // 现从事专业
  17. zw: { type: String }, // 职务
  18. zc: { type: String }, // 职称
  19. password: { type: Secret, select: false },
  20. status: { type: String, default: '0' }, // 0=>使用中;-1=>禁用中
  21. remark: { type: String, maxLength: 200 },
  22. create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') },
  23. };
  24. const schema = new Schema(achieve_expert, { toJSON: { virtuals: true } });
  25. schema.index({ id: 1 });
  26. schema.index({ expert_user_id: 1 });
  27. schema.index({ expert_name: 1 });
  28. schema.index({ phone: 1 });
  29. schema.index({ apply_id: 1 });
  30. schema.index({ status: 1 });
  31. schema.index({ 'meta.createdAt': 1 });
  32. schema.plugin(metaPlugin);
  33. module.exports = app => {
  34. const { mongoose } = app;
  35. return mongoose.model('Achieve_expert', schema, 'achieve_expert');
  36. };