'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 trainUser = { train_id: { type: String, zh: '培训问诊id' }, name: { type: String, zh: '姓名' }, phone: { type: String, zh: '电话' }, password: { type: Secret, select: false }, // 注册密码 status: { type: String, zh: '状态', default: '0' }, // 0-待审;1-审核通过;2-审核拒绝 remark: { type: String }, }; const schema = new Schema(trainUser, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ phone: 1 }); schema.index({ name: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('TrainUser', schema, 'trainUser'); };