lessonmode.js 751 B

1234567891011121314151617181920
  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. allday: { type: String, required: false, maxLength: 20 }, // 类型,0-全天,1-半天
  9. lessons: { type: String, required: false }, // 课程信息
  10. };
  11. const schema = new Schema(LessonmodeSchema, { toJSON: { virtuals: true } });
  12. schema.index({ id: 1 });
  13. schema.plugin(metaPlugin);
  14. module.exports = app => {
  15. const { mongoose } = app;
  16. return mongoose.model('Lessonmode', schema, 'lessonmode');
  17. };