studentApplyForSchool.js 1.1 KB

123456789101112131415161718192021222324
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  4. // 学员入学申请
  5. const studentApplyForSchool = {
  6. student_id: { type: String, required: true, zh: '学生id', ref: 'Student', getProp: [ 'name', 'icon', 'level', 'phone' ] }, //
  7. school_id: { type: String, required: true, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, //
  8. result: { type: String, required: false, default: '0', zh: '审核结果' }, // 0-未审核;1-审核通过;-1-审核拒绝
  9. time: { type: String, required: false, zh: '申请时间' }, //
  10. reason: { type: String, required: false, zh: '审核理由' }, //
  11. };
  12. const schema = new Schema(studentApplyForSchool, { toJSON: { virtuals: true } });
  13. schema.index({ id: 1 });
  14. schema.index({ 'meta.createdAt': 1 });
  15. schema.index({ student_id: 1 });
  16. schema.index({ school_id: 1 });
  17. schema.index({ result: 1 });
  18. schema.plugin(metaPlugin);
  19. module.exports = app => {
  20. const { mongoose } = app;
  21. return mongoose.model('StudentApplyForSchool', schema, 'studentApplyForSchool');
  22. };