liveroom.js 1.0 KB

123456789101112131415161718192021222324
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 教师直播房间
  5. const LiveroomSchema = {
  6. number: { type: String, required: true, maxLength: 200 }, // 房间号
  7. subid: { type: String, required: true, maxLength: 200 }, // 科目id
  8. teacher: { type: String, required: true, maxLength: 200 }, // 教师id
  9. teacherid: { type: String, required: true, maxLength: 200 }, // 教师id
  10. status: { type: String, required: false, maxLength: 200, default: "0" }, // 状态:0=>未审核;1=>通过;2=>拒绝
  11. start: { type: Boolean, required: true, maxLength: 200, default: false }, // true=>开始直播;false=>未开始
  12. reason: { type: String, required: false, maxLength: 2000 }, // 申请原因
  13. };
  14. const schema = new Schema(LiveroomSchema, { toJSON: { virtuals: true } });
  15. schema.index({ id: 1 });
  16. schema.plugin(metaPlugin);
  17. module.exports = app => {
  18. const { mongoose } = app;
  19. return mongoose.model('Liveroom', schema, 'liveroom');
  20. };