'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 课程模板表 const LessonmodeSchema = { title: { type: String, required: true, maxLength: 500 }, // 标题 type: { type: String, required: true, maxLength: 500 }, // 类型,0-普通班,1-特殊班 allday: { type: String, required: false, maxLength: 20 }, // 类型,0-全天,1-半天 lessons: { type: String, required: false }, // 课程信息 }; const schema = new Schema(LessonmodeSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Lessonmode', schema, 'lessonmode'); };