room.js 1.2 KB

1234567891011121314151617181920212223242526
  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. starttime: { type: String, required: false }, // 开始时间
  14. endtime: { type: String, required: false }, // 结束时间
  15. status: { type: String, required: false, maxLength: 64, default: '0' }, // 状态0、开启1、关闭
  16. };
  17. const schema = new Schema(RoomSchema, { toJSON: { virtuals: true } });
  18. schema.index({ id: 1 });
  19. schema.plugin(metaPlugin);
  20. module.exports = app => {
  21. const { mongoose } = app;
  22. return mongoose.model('Room', schema, 'room');
  23. };