room.js 898 B

1234567891011121314151617181920
  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. title: { type: String, required: true, maxLength: 200 }, // 房间标题
  7. owner_id: { type: String, required: true, maxLength: 200 }, // 管理人id
  8. owner_name: { type: String, required: true, maxLength: 200 }, // 管理人名称
  9. room_status: { type: String, default: '0', maxLength: 1 }, // 房间状态:0未审核;1可使用;2已冻结
  10. live_status: { type: String, default: '0', maxLength: 1 }, // 直播状态:0已下播;1直播中
  11. };
  12. const schema = new Schema(Room, { toJSON: { virtuals: true } });
  13. schema.index({ id: 1 });
  14. schema.plugin(metaPlugin);
  15. module.exports = app => {
  16. const { mongoose } = app;
  17. return mongoose.model('Room', schema, 'live_room');
  18. };