Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 중복된 여러개의 lecture_id 삭제 해결 #1128

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ default TimetableLecture getById(Integer id) {

TimetableLecture save(TimetableLecture timetableLecture);

Optional<TimetableLecture> findByTimetableFrameIdAndLectureId(Integer frameId, Integer lectureId);

default TimetableLecture getByFrameIdAndLectureId(Integer frameId, Integer lectureId) {
return findByTimetableFrameIdAndLectureId(frameId, lectureId)
.orElseThrow(() -> TimetableLectureNotFoundException.withDetail("frameId: " + frameId + ", lectureId: " + lectureId));
}
List<TimetableLecture> findAllByTimetableFrameIdAndLectureId(Integer frameId, Integer lectureId);

@Query(value = "SELECT * FROM timetable_lecture WHERE id = :id", nativeQuery = true)
Optional<TimetableLecture> findByIdWithDeleted(@Param("id") Integer id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public void deleteTimetableLectures(List<Integer> request, Integer userId) {
public void deleteTimetableLectureByFrameId(Integer frameId, Integer lectureId, Integer userId) {
TimetableFrame frame = timetableFrameRepositoryV2.getById(frameId);
validateUserAuthorization(frame.getUser().getId(), userId);
TimetableLecture timetableLecture = timetableLectureRepositoryV2.getByFrameIdAndLectureId(frameId, lectureId);
timetableLecture.delete();
timetableLectureRepositoryV2.findAllByTimetableFrameIdAndLectureId(frameId, lectureId).forEach(TimetableLecture::delete);
}

@Transactional
Expand Down
Loading