'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 班级类型表 const ClasstypeSchema = { name: { type: String, required: true, maxLength: 500 }, // 班级类型名称 code: { type: String, required: false, maxLength: 200 }, // 班级类型代码(自定义) bedroom: { type: String, required: false, maxLength: 200 }, // 0分配;1填写 寝室 sign: { type: String, required: false, maxLength: 200 }, // 0学生签到;1教师签到 hascar: { type: String, required: false, maxLength: 500 }, // 是否派车,0-否,1-是 }; const schema = new Schema(ClasstypeSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Classtype', schema, 'classtype'); };