roomuser.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const RoomUserSchema = {
  5. name: { type: String, required: false, maxLength: 200 }, // 名称
  6. phone: { type: String, required: true, maxLength: 64 }, // 手机
  7. passwd: { type: String, select: false }, // 注册密码
  8. openid: { type: String, required: false }, // 微信openid
  9. age: { type: String, required: false, maxLength: 64 }, // 年龄
  10. gender: { type: String, required: false, maxLength: 64 }, // 性别
  11. idnumber: { type: String, required: false, maxLength: 64 }, // 身份证号
  12. major: { type: String, required: false }, // 专业
  13. isjc: { type: Boolean, required: false }, // 是否基层
  14. isxf: { type: String, required: false }, // 是否授予学分
  15. address: { type: String, required: false, maxLength: 200 }, // 单位所在地
  16. role: { type: String, required: false }, // 3-主播 4、房间用户
  17. hosname: { type: String, required: false }, // 医院名称
  18. deptname: { type: String, required: false }, // 机构名称
  19. level: { type: String, required: false }, // 职务
  20. title: { type: String, required: false }, // 个人简介
  21. remark: { type: String, required: false }, // 备注
  22. switchrole: { type: String, required: false }, // 直播身份 ‘anchor’ 主播 ‘audience’ 观众
  23. };
  24. const schema = new Schema(RoomUserSchema, { toJSON: { virtuals: true } });
  25. schema.index({ id: 1 });
  26. schema.plugin(metaPlugin);
  27. module.exports = app => {
  28. const { mongoose } = app;
  29. return mongoose.model('Roomuser', schema, 'room_user');
  30. };