roomuser.js 1.0 KB

1234567891011121314151617181920212223242526
  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. role: { type: String, required: false }, // 3-主播 4、房间用户
  10. hosname: { type: String, required: false }, // 医院名称
  11. deptname: { type: String, required: false }, // 机构名称
  12. level: { type: String, required: false }, // 职务
  13. title: { type: String, required: false }, // 个人简介
  14. remark: { type: String, required: false }, // 备注
  15. };
  16. const schema = new Schema(RoomUserSchema, { toJSON: { virtuals: true } });
  17. schema.index({ id: 1 });
  18. schema.plugin(metaPlugin);
  19. module.exports = app => {
  20. const { mongoose } = app;
  21. return mongoose.model('Roomuser', schema, 'room_user');
  22. };