'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 教师申请讲课表 const ApplySchema = { termid: { type: String, required: true, maxLength: 200 }, // 申请期id subid: { type: String, required: true, maxLength: 200 }, // 科目id teacherid: { type: String, required: true, maxLength: 200 }, // 教师id reason: { type: String, required: false, maxLength: 2000 }, // 申请原因 }; const schema = new Schema(ApplySchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Apply', schema, 'apply'); };