12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- const { Secret } = require('naf-framework-mongoose-free/lib/model/schema');
- const { ObjectId } = require('mongoose').Types;
- // 专家表
- const expert = {
- name: { type: String, required: true }, // 用户名
- phone: { type: String, required: false, maxLength: 200 }, // 电话号码
- password: { type: Secret, required: true, select: false }, // 登录密码
- card: { type: String, required: false, maxLength: 200 }, // 身份证号
- birth: { type: String, required: false, maxLength: 500 }, // 出生日期
- qqwx: { type: String, required: false, maxLength: 500 }, // qq&微信
- email: { type: String, required: false, maxLength: 500 }, // 邮箱
- zwzc: { type: String, required: false, maxLength: 500 }, // 职务职称
- education: { type: String, required: false, maxLength: 500 }, // 最高学历
- school: { type: String, required: false, maxLength: 500 }, // 毕业院校
- major: { type: String, required: false, maxLength: 200 }, // 专业
- company: { type: String, required: false, maxLength: 500 }, // 单位名称
- icon: { type: Array, required: false }, // 头像图片
- expertise: { type: String, required: false, maxLength: 500 }, // 擅长领域
- workexperience: { type: String, required: false, maxLength: 500 }, // 工作经历
- scientific: { type: String, required: false, maxLength: 500 }, // 科研综述
- undertakingproject: { type: String, required: false, maxLength: 500 }, // 承担项目
- scienceaward: { type: String, required: false, maxLength: 500 }, // 科技奖励
- social: { type: String, required: false, maxLength: 500 }, // 社会任职
- status: { type: String, required: false, default: '0', maxLength: 500 }, // 审核状态,0-注册,1-通过,2-拒绝
- remark: { type: String, maxLength: 200 },
- };
- const schema = new Schema(expert, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ name: 1 });
- schema.index({ phone: 1 });
- schema.index({ card: 1 });
- schema.index({ education: 1 });
- schema.index({ status: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Expert', schema, 'expert');
- };
|