trainvideo.js 1.1 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 TrainVideoSchema = {
  6. url: { 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: false, maxLength: 200 }, // 教师姓名
  10. teacherid: { type: String, required: false, maxLength: 200 }, // 教师id
  11. status: { type: String, required: false, maxLength: 200, default: "0" }, // 状态:0=>未审核;1=>审核通过(中心直接传来,通过);2=>审核失败
  12. touser: { type: String, required: false, maxLength: 20 }, // 面向对象:0=>所有人;1=>教师;2=>学生;3=>班主任
  13. };
  14. const schema = new Schema(TrainVideoSchema, { toJSON: { virtuals: true } });
  15. schema.index({ id: 1 });
  16. schema.plugin(metaPlugin);
  17. module.exports = app => {
  18. const { mongoose } = app;
  19. return mongoose.model('Trainvideo', schema, 'trainvideo');
  20. };