Skip to content

Commit

Permalink
Fix: 과릿 1.0.4 (#259)
Browse files Browse the repository at this point in the history
* Fix: 과릿 1.0.4 (#258)

* Fix: 수업리포트 수정 API 선생님 권한 조건 추가 (#257)
  • Loading branch information
dl-00-e8 authored Nov 3, 2023
1 parent 9e81432 commit 5dd16f0
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.selfrunner.gwalit.domain.member.entity.Member;
import com.selfrunner.gwalit.domain.member.entity.MemberAndLecture;
import com.selfrunner.gwalit.domain.member.entity.MemberMeta;
import com.selfrunner.gwalit.domain.member.entity.MemberType;
import com.selfrunner.gwalit.domain.member.exception.MemberException;
import com.selfrunner.gwalit.domain.member.repository.MemberAndLectureRepository;
import com.selfrunner.gwalit.global.common.Schedule;
Expand Down Expand Up @@ -72,6 +73,9 @@ public LessonIdRes register(Member member, PostLessonReq postLessonReq) {
@Transactional
public LessonRes update(Member member, Long lessonId, PutLessonReq putLessonReq) {
// Validation
if(!member.getType().equals(MemberType.TEACHER)) {
throw new LessonException(ErrorCode.UNAUTHORIZED_EXCEPTION);
}
Lesson lesson = lessonRepository.findById(lessonId).orElseThrow(() -> new LessonException(ErrorCode.NOT_EXIST_LESSON));
MemberAndLecture memberAndLecture = memberAndLectureRepository.findMemberAndLectureByMemberAndLectureLectureId(member, lesson.getLecture().getLectureId()).orElseThrow(() -> new MemberException(ErrorCode.UNAUTHORIZED_EXCEPTION));

Expand Down

0 comments on commit 5dd16f0

Please sign in to comment.