Skip to content

Commit

Permalink
fix: 조회 조건 변경 (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
seongjae6751 authored Jul 5, 2024
1 parent ed1a765 commit ef98dc8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public interface LectureRepository extends Repository<Lecture, Integer> {

Optional<Lecture> findById(Integer id);

Optional<Lecture> findBySemesterAndNameAndLectureClass(String semesterDate, String name, String classLecture);
Optional<Lecture> findBySemesterAndCodeAndLectureClass(String semesterDate, String code, String classLecture);

default Lecture getBySemesterAndNameAndLectureClass(String semesterDate, String name, String classLecture) {
return findBySemesterAndNameAndLectureClass(semesterDate, name, classLecture)
.orElseThrow(() -> SemesterNotFoundException.withDetail("semester: " + semesterDate + " name: " + name + " classLecture: " + classLecture));
default Lecture getBySemesterAndCodeAndLectureClass(String semesterDate, String code, String classLecture) {
return findBySemesterAndCodeAndLectureClass(semesterDate, code, classLecture)
.orElseThrow(() -> SemesterNotFoundException.withDetail("semester: " + semesterDate + " code: " + code + " classLecture: " + classLecture));
}

default Lecture getLectureById(Integer id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public TimetableResponse createTimetables(Integer userId, TimetableCreateRequest
semester.getId());

for (TimetableCreateRequest.InnerTimetableRequest timeTable : request.timetable()) {
Lecture lecture = lectureRepository.getBySemesterAndNameAndLectureClass(request.semester(),
timeTable.classTitle(), timeTable.lectureClass());
Lecture lecture = lectureRepository.getBySemesterAndCodeAndLectureClass(request.semester(),
timeTable.code(), timeTable.lectureClass());
TimetableLecture timetableLecture = TimetableLecture.builder()
.classPlace(timeTable.classPlace())
.grades("0")
Expand Down

0 comments on commit ef98dc8

Please sign in to comment.