123456789101112131415161718192021222324252627282930313233 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const lessonInfo = new Schema({
- teaname: { type: String, required: false, maxLength: 500 },
- teaid: { type: String, required: false, maxLength: 500 },
- subname: { type: String, required: false, maxLength: 200 },
- subid: { type: String, required: false, maxLength: 200 },
- date: { type: String, required: false, maxLength: 500 },
- time: { type: String, required: false, maxLength: 500 },
- day: { type: String, required: false, maxLength: 500 },
- reason: { type: String, required: false, maxLength: 500 },
- });
- const LessonSchema = {
- classid: { type: String, required: true, maxLength: 500 },
- termid: { type: String, required: true, maxLength: 500 },
- batchid: { type: String, required: true, maxLength: 500 },
- lessons: { type: [ lessonInfo ], required: false, select: true },
- status: { type: String, required: false, maxLength: 500, default: '0' },
- };
- const schema = new Schema(LessonSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Lesson', schema, 'lesson');
- };
|