1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const classInfo = new Schema({
- name: { type: String, required: false, maxLength: 200 },
- number: { type: String, required: false, maxLength: 200 },
- type: { type: String, required: false, maxLength: 200 },
- headteacherid: { type: String, required: false, maxLength: 200 },
- lessons: { type: [Object], required: false },
- hasclass: { type: String, required: false, maxLength: 200 },
- });
- const batchInfo = new Schema({
- batch: { type: String, required: false, maxLength: 200 },
- class: { type: [classInfo], required: false, select: true },
- startdate: { type: String, required: false, maxLength: 200 },
- enddate: { type: String, required: false, maxLength: 200 },
- lessons: { type: [Object], required: false },
-
-
-
- color: { type: String, required: false, maxLength: 200 },
- reteacher: { type: String, required: false, maxLength: 200 },
- place: { type: String, required: false, maxLength: 200 },
- });
- const classNumInfo = new Schema({
- name: { type: String, required: false, maxLength: 200 },
- number: { type: String, required: false, maxLength: 200 },
- code: { type: String, required: false, maxLength: 200 },
- });
- const schInfo = new Schema({
- code: { type: String, required: false, maxLength: 200 },
- classnum: { type: [classNumInfo], select: true },
- num: { type: String, required: false, maxLength: 200 },
- });
- const termInfo = new Schema({
- term: { type: String, required: false, maxLength: 200 },
- classnum: { type: String, required: false, maxLength: 200 },
- batchnum: { type: [batchInfo], select: true },
- placereteacher: { type: Object, required: false },
- reteacher: { type: String, required: false, maxLength: 2000 },
- });
- const festivalInfo = new Schema({
- begindate: { type: String, required: false, maxLength: 200 },
- finishdate: { type: String, required: false, maxLength: 200 },
- name: { type: String, required: false, maxLength: 200 },
- });
- const remarkInfo = new Schema({
- month: { type: String, required: false, maxLength: 20 },
- class: { type: String, required: false, maxLength: 200 },
- number: { type: String, required: false, maxLength: 200 },
- });
- const TrainplanSchema = {
- planyearid: { type: String, required: true, maxLength: 200 },
- year: { type: String, required: true, maxLength: 200 },
- title: { type: String, required: true, maxLength: 500 },
- status: { type: String, required: false, maxLength: 200, default: '0' },
- termnum: { type: [termInfo], select: true },
- remark: { type: [remarkInfo], select: true },
- school: { type: [schInfo], select: true },
- festivals: { type: [festivalInfo], select: true },
- };
- const schema = new Schema(TrainplanSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = (app) => {
- const { mongoose } = app;
- return mongoose.model('Trainplan', schema, 'trainplan');
- };
|