'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); // 学员入学申请 const studentApplyForSchool = { student_id: { type: String, required: true, zh: '学生id', ref: 'Student', getProp: [ 'name', 'icon', 'level', 'phone' ] }, // school_id: { type: String, required: true, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, // result: { type: String, required: false, default: '0', zh: '审核结果' }, // 0-未审核;1-审核通过;-1-审核拒绝 time: { type: String, required: false, zh: '申请时间' }, // reason: { type: String, required: false, zh: '审核理由' }, // }; const schema = new Schema(studentApplyForSchool, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.index({ student_id: 1 }); schema.index({ school_id: 1 }); schema.index({ result: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('StudentApplyForSchool', schema, 'studentApplyForSchool'); };