'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 教师直播房间 const LiveroomSchema = { number: { type: String, required: true, maxLength: 200 }, // 房间号 subid: { type: String, required: true, maxLength: 200 }, // 科目id subname: { type: String, required: true, maxLength: 200 }, // 科目 teacher: { type: String, required: true, maxLength: 200 }, // 教师id teacherid: { type: String, required: true, maxLength: 200 }, // 教师id status: { type: String, required: false, maxLength: 200, default: '0' }, // 状态:0=>未审核;1=>通过;2=>拒绝 start: { type: Boolean, required: true, maxLength: 200, default: false }, // true=>开始直播;false=>未开始 reason: { type: String, required: false, maxLength: 2000 }, // 申请原因 }; const schema = new Schema(LiveroomSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Liveroom', schema, 'liveroom'); };