trainUser.js 998 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  5. const { Secret } = require('naf-framework-mongoose-free/lib/model/schema');
  6. const { ObjectId } = require('mongoose').Types;
  7. // 培训问诊--用户表
  8. const trainUser = {
  9. train_id: { type: String, zh: '培训问诊id' },
  10. name: { type: String, zh: '姓名' },
  11. phone: { type: String, zh: '电话' },
  12. password: { type: Secret, select: false }, // 注册密码
  13. status: { type: String, zh: '状态', default: '0' }, // 0-待审;1-审核通过;2-审核拒绝
  14. remark: { type: String },
  15. };
  16. const schema = new Schema(trainUser, { toJSON: { virtuals: true } });
  17. schema.index({ id: 1 });
  18. schema.index({ phone: 1 });
  19. schema.index({ name: 1 });
  20. schema.index({ 'meta.createdAt': 1 });
  21. schema.plugin(metaPlugin);
  22. module.exports = app => {
  23. const { mongoose } = app;
  24. return mongoose.model('TrainUser', schema, 'trainUser');
  25. };