-
Notifications
You must be signed in to change notification settings - Fork 0
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] #162 - 공연 삭제 로직 변경 #163
Conversation
… 예매 테이블에도 존재하는지 비교하도록 변경
…직 변경 및 해당 공연의 메이커만 공연삭제가 가능하도록 변경
@@ -32,5 +32,6 @@ Optional<Booking> findFirstByBookerNameAndBookerPhoneNumberAndBirthDateAndPasswo | |||
|
|||
List<Booking> findByUsersId(Long userId); | |||
|
|||
boolean existsBySchedulePerformanceId(Long performanceId); | |||
@Query("SELECT COUNT(b) > 0 FROM Booking b WHERE b.schedule.id IN :scheduleIds") | |||
boolean existsByScheduleIdIn(@Param("scheduleIds") List<Long> scheduleIds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean 이름에 In 붙이신 의도가 무엇일까요? 혹시 오타인지 확인 부탁드립니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이름은 IN 연산자를 사용하는 SQL 쿼리의 의미를 나타내기 위해 사용했습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scheduleId로 조회해서 공연 삭제하는 로직, promotion 양방향 매핑으로 performance 삭제 시 promotion도 함께 삭제되도록 구현하신 것 모두 좋습니다!
예매자 입금여부 수정 api도 삭제 api와 동일하게 경로 수정하도록 하겠습니다!
Related issue 🛠
Work Description ✏️
공연 삭제 로직 - 기존
공연 삭제 로직 - 변경
변경 사유
promotion 양방향 매핑
불필요한 pathVariable 어노테이션 제거
Trouble Shooting ⚽️
Related ScreenShot 📷
해당 공연의 메이커가 아닌 경우 수정 페이지 공연 조회 불가
예매자가 하나도 없는 경우 isBookerExist : false 확인
1회차 예매 진행 -> isBookerExist : true 확인 따라서 해당 jpql로 지어진 메서드가 잘 작동되는지 확인 완료
1회차 예매 진행한 공연의 경우 삭제가 되지 않는거 확인 완료
예매가 없는 공연의 경우 삭제가 되는거 확인 완료
해당 공연의 메이커가 아니면 예매자를 삭제할 수 없도록 변경
정상적으로 예매자 삭제 완료 및 DB에서도 확인 완료
다시 11번째 공연을 조회하면 isBookerExist가 false로 변경된거 확인 가능
공연 삭제 가능 및 cascade로 performanceId=11을 가지고 있는 테이블(schedule, promotion, cast, staff) 튜플 삭제 확인
Uncompleted Tasks 😅
To Reviewers 📢