room.js 817 B

12345678910111213141516171819
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. const Room = {
  5. number: { type: String, required: true, maxLength: 200 }, // 房间号
  6. owner_id: { type: String, required: true, maxLength: 200 }, // 播主id
  7. owner_name: { type: String, required: true, maxLength: 200 }, // 播主名称
  8. room_status: { type: String, default: '0', maxLength: 1 }, // 房间状态:0未审核;1可使用;2已冻结
  9. live_status: { type: String, default: '0', maxLength: 1 }, // 直播状态:0已下播;1直播中
  10. };
  11. const schema = new Schema(Room, { toJSON: { virtuals: true } });
  12. schema.index({ id: 1 });
  13. schema.plugin(metaPlugin);
  14. module.exports = app => {
  15. const { mongoose } = app;
  16. return mongoose.model('Room', schema, 'live_room');
  17. };