liveroom.js 1.1 KB

12345678910111213141516171819202122232425
  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. subname: { type: String, required: true, maxLength: 200 }, // 科目
  9. teacher: { type: String, required: true, maxLength: 200 }, // 教师id
  10. teacherid: { type: String, required: true, maxLength: 200 }, // 教师id
  11. status: { type: String, required: false, maxLength: 200, default: '0' }, // 状态:0=>未审核;1=>通过;2=>拒绝
  12. start: { type: Boolean, required: true, maxLength: 200, default: false }, // true=>开始直播;false=>未开始
  13. reason: { type: String, required: false, maxLength: 2000 }, // 申请原因
  14. };
  15. const schema = new Schema(LiveroomSchema, { toJSON: { virtuals: true } });
  16. schema.index({ id: 1 });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('Liveroom', schema, 'liveroom');
  21. };