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