Skip to content

Commit

Permalink
fix: 야간잔류 신청과 신청자 사이의 연관관계로 인해 신청 삭제가 불가한 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
holyPigeon committed Dec 5, 2024
1 parent 346b4e7 commit 2404537
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ public void deleteApplication(Long id) {
Application application = applicationRepository.findById(id)
.orElseThrow(() -> new IllegalArgumentException(APPLICATION_NOT_FOUND.getMessage()));

applicantRepository.deleteAll(applicantRepository.findApplicantsByApplicationId(id));
applicationRepository.delete(application);
}

public ApplicationResponse getDetailApplication(Long id) {
Application application = applicationRepository.findById(id)
.orElseThrow(() -> new IllegalArgumentException(APPLICATION_NOT_FOUND.getMessage()));
List<Member> coApplicants = applicantRepository.findApplicantsByApplicationId(id);
List<Member> coApplicants = applicantRepository.findMembersByApplicationId(id);

return fromEntity(application, coApplicants);
}
Expand All @@ -74,7 +75,7 @@ public List<ApplicationResponse> findByMember(Member member) {
.stream()
.map(application -> fromEntity(
application,
applicantRepository.findApplicantsByApplicationId(application.getId())
applicantRepository.findMembersByApplicationId(application.getId())
)).toList();
}

Expand Down

0 comments on commit 2404537

Please # to comment.