123456789101112131415161718192021222324252627282930313233343536 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- const { Secret } = require('naf-framework-mongoose/lib/model/schema');
- // 专家临时账号表
- // 使用手机号密码登录
- const achieve_expert = {
- expert_user_id: { type: ObjectId }, // 专家的用户id
- expert_name: { type: String }, // 专家姓名
- phone: { type: String }, // 电话/登陆用
- company: { type: String }, // 工作单位
- group_zw: { type: String }, // 评价专家组职务
- major: { type: String }, // 所学专业
- now_major: { type: String }, // 现从事专业
- zw: { type: String }, // 职务
- zc: { type: String }, // 职称
- password: { type: Secret, select: false },
- status: { type: String, default: '0' }, // 0=>使用中;-1=>禁用中
- remark: { type: String, maxLength: 200 },
- create_time: { type: String, default: moment().format('YYYY-MM-DD HH:mm:ss') },
- };
- const schema = new Schema(achieve_expert, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ expert_user_id: 1 });
- schema.index({ expert_name: 1 });
- schema.index({ phone: 1 });
- schema.index({ apply_id: 1 });
- schema.index({ status: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Achieve_expert', schema, 'achieve_expert');
- };
|