room.js 908 B

123456789101112131415161718192021
  1. 'use strict';
  2. // 弃用
  3. const Schema = require('mongoose').Schema;
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const Room = {
  6. number: { type: String, required: true, maxLength: 200 }, // 房间号
  7. title: { type: String, required: true, maxLength: 200 }, // 房间标题
  8. owner_id: { type: String, required: true, maxLength: 200 }, // 管理人id
  9. owner_name: { type: String, required: true, maxLength: 200 }, // 管理人名称
  10. room_status: { type: String, default: '0', maxLength: 1 }, // 房间状态:0未审核;1可使用;2已冻结
  11. live_status: { type: String, default: '0', maxLength: 1 }, // 直播状态:0已下播;1直播中
  12. };
  13. const schema = new Schema(Room, { 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, 'live_room');
  19. };