lesson.js 975 B

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. const { CrudService } = require('naf-framework-mongoose-free/lib/service');
  3. const { BusinessError, ErrorCode } = require('naf-core').Error;
  4. const _ = require('lodash');
  5. const assert = require('assert');
  6. //
  7. class LessonService extends CrudService {
  8. constructor(ctx) {
  9. super(ctx, 'lesson');
  10. this.model = this.ctx.model.Business.Lesson;
  11. }
  12. // TODO:缺少:使用coach_id/student_id查询课程:教练/学生看自己的课程
  13. // TODO:缺少:修改课程为下课状态,给教师结工资的问题
  14. /**
  15. * 处理下课的课程进行结算
  16. * @param {Object} filter 修改条件
  17. * @param {Object} body 修改内容
  18. * @param {Object} data 修改后的结果
  19. * @return {Object} 返回整理后的内容
  20. */
  21. async afterUpdate(filter, body, data) {
  22. const { _id: lesson_id, type, status } = data;
  23. if (status !== '4') return data;
  24. // 公开课,每个教师都带着
  25. return data;
  26. }
  27. }
  28. module.exports = LessonService;