12345678910111213141516171819202122232425262728293031 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 班级表
- const ClassSchema = {
- name: { type: String, required: true, maxLength: 500 }, // 班级名称
- number: { type: String, required: false, maxLength: 200 }, // 人数
- batchid: { type: String, required: false, maxLength: 200 }, // 批次
- termid: { type: String, required: false, maxLength: 200 }, // 期
- planid: { type: String, required: false, maxLength: 200 }, // 计划
- planyearid: { type: String, required: false, maxLength: 200 }, // 大批次id
- headteacherid: { type: String, required: false, maxLength: 200 }, // 班主任id
- lyteacherid: { type: String, required: false, maxLength: 200 }, // 礼仪课老师id
- yclocationid: { type: String, required: false, maxLength: 200 }, // 用餐地点id
- kzjhlocationid: { type: String, required: false, maxLength: 200 }, // 拓展计划地点id
- kbyslocationid: { type: String, required: false, maxLength: 200 }, // 开班仪式地点id
- jslocationid: { type: String, required: false, maxLength: 200 }, // 教室位置id
- lessonid: { type: String, required: false, maxLength: 200 }, // 课程表id
- type: { type: String, required: false, maxLength: 200 }, // 类型:0-正常,1-特殊
- };
- const schema = new Schema(ClassSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Class', schema, 'class');
- };
|