coachInBill.js 965 B

1234567891011121314151617181920212223
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
  4. // 教练费明细
  5. const coachInBill = {
  6. lesson_id: { type: String, required: false, zh: '课程id' }, //
  7. type: { type: String, required: false, zh: '类型' }, // 0:公开课收入;1私教课收入;2提现
  8. school_id: { type: String, required: false, zh: '学校id', ref: 'School', getProp: [ 'name' ] }, //
  9. coach_id: { type: String, required: false, zh: '教练id', ref: 'Coach', getProp: [ 'name' ] }, //
  10. money: { type: Number, required: false, zh: '金额' }, //
  11. };
  12. const schema = new Schema(coachInBill, { toJSON: { virtuals: true } });
  13. schema.index({ id: 1 });
  14. schema.index({ 'meta.createdAt': 1 });
  15. schema.index({ school_id: 1 });
  16. schema.index({ coach_id: 1 });
  17. schema.plugin(metaPlugin);
  18. module.exports = app => {
  19. const { mongoose } = app;
  20. return mongoose.model('CoachInBill', schema, 'coachInBill');
  21. };