lessonmode.js 659 B

12345678910111213141516171819
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  4. // 课程模板表
  5. const LessonmodeSchema = {
  6. title: { type: String, required: true, maxLength: 500 }, // 标题
  7. type: { type: String, required: true, maxLength: 500 }, // 类型,0-普通班,1-特殊班
  8. lessons: { type: String, required: false }, // 课程信息
  9. };
  10. const schema = new Schema(LessonmodeSchema, { toJSON: { virtuals: true } });
  11. schema.index({ id: 1 });
  12. schema.plugin(metaPlugin);
  13. module.exports = app => {
  14. const { mongoose } = app;
  15. return mongoose.model('Lessonmode', schema, 'lessonmode');
  16. };