room.js 1.1 KB

123456789101112131415161718192021222324
  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. title: { type: String, required: false, maxLength: 200 }, // 标题
  7. type: { type: String, required: false, maxLength: 64 }, // 类型0、直播1、会议
  8. filedir: { type: String, required: false, maxLength: 200 }, // 封面图片
  9. url: { type: String, required: false, maxLength: 200 }, // 房间地址
  10. content: { type: String, required: false }, // 直播简介
  11. anchorid: { type: String, required: false, maxLength: 200 }, // 主播id
  12. username: { type: String, required: false, maxLength: 200 }, // 主播名称
  13. status: { type: String, required: false, maxLength: 64, default: '0' }, // 状态0、开启1、关闭
  14. };
  15. const schema = new Schema(RoomSchema, { toJSON: { virtuals: true } });
  16. schema.index({ id: 1 });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('Room', schema, 'room');
  21. };