'use strict'; // 弃用 const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); const Room = { number: { type: String, required: true, maxLength: 200 }, // 房间号 title: { type: String, required: true, maxLength: 200 }, // 房间标题 owner_id: { type: String, required: true, maxLength: 200 }, // 管理人id owner_name: { type: String, required: true, maxLength: 200 }, // 管理人名称 room_status: { type: String, default: '0', maxLength: 1 }, // 房间状态:0未审核;1可使用;2已冻结 live_status: { type: String, default: '0', maxLength: 1 }, // 直播状态:0已下播;1直播中 }; const schema = new Schema(Room, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Room', schema, 'live_room'); };