'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 教师申请讲课表 const TrainVideoSchema = { url: { type: String, required: true, maxLength: 200 }, // 视频地址 subid: { type: String, required: true, maxLength: 200 }, // 科目id teacher: { type: String, required: true, maxLength: 200 }, // 教师姓名 teacherid: { type: String, required: true, maxLength: 200 }, // 教师id touser: { type: String, required: false, maxLength: 20 }, // 面向对象:0=>所有人;1=>教师;2=>学生;3=>班主任 }; const schema = new Schema(TrainVideoSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Trainvideo', schema, 'trainvideo'); };