1234567891011121314151617181920212223242526272829 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- // 临时上课申请
- const tempLessonApply = {
- 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' ] }, //
- coach_id: { type: String, required: false, zh: '教练id', ref: 'Coach', getProp: [ 'name' ] }, //
- img_url: { type: Array, required: false, zh: '证据' }, //
- money: { type: Number, required: false, zh: '金额' }, //
- pay_id: { type: Array, required: false, zh: '支付id', ref: 'PayOrder' }, //
- };
- const schema = new Schema(tempLessonApply, { 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({ coach_id: 1 });
- schema.index({ result: 1 });
- schema.index({ pay_id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('TempLessonApply', schema, 'tempLessonApply');
- };
|