room.js 962 B

12345678910111213141516171819202122
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const RoomSchema = {
  5. name: { type: String, required: false, maxLength: 200 }, // 房间名称
  6. type: { type: String, required: false, maxLength: 64 }, // 类型0、直播1、会议
  7. filedir: { type: String, required: false, maxLength: 200 }, // 封面图片
  8. url: { type: String, required: false, maxLength: 200 }, // 房间地址
  9. anchorid: { type: String, required: false, maxLength: 200 }, // 主播id
  10. username: { type: String, required: false, maxLength: 200 }, // 主播名称
  11. status: { type: String, required: false, maxLength: 64, default: '0' }, // 状态0、开启1、关闭
  12. };
  13. const schema = new Schema(RoomSchema, { toJSON: { virtuals: true } });
  14. schema.index({ id: 1 });
  15. schema.plugin(metaPlugin);
  16. module.exports = app => {
  17. const { mongoose } = app;
  18. return mongoose.model('Room', schema, 'room');
  19. };