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