Skip to content
Merged
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 @@ -27,17 +27,13 @@ public interface ApplicationRepository extends JpaRepository<Application, Long>
""")
List<Application> findAllByUnivApplyInfoIds(@Param("univApplyInfoIds") List<Long> univApplyInfoIds, @Param("status") VerifyStatus status, @Param("termId") long termId);

@Query("""
SELECT a
FROM Application a
WHERE a.siteUserId = :siteUserId
AND a.termId = :termId
AND a.isDelete = false
""")
Optional<Application> findBySiteUserIdAndTermId(@Param("siteUserId") long siteUserId, @Param("termId") long termId);
// TODO: 근본 해결 필요
// 지원서 유일성은 DB 제약으로 강제하고
// 이 조회는 임시 회피 로직을 제거하는 방향으로 수정 필요.
Optional<Application> findTopBySiteUserIdAndTermIdAndIsDeleteFalseOrderByIdDesc(long siteUserId, long termId);

default Application getApplicationBySiteUserIdAndTermId(long siteUserId, long termId) {
return findBySiteUserIdAndTermId(siteUserId, termId)
return findTopBySiteUserIdAndTermIdAndIsDeleteFalseOrderByIdDesc(siteUserId, termId)
.orElseThrow(() -> new CustomException(APPLICATION_NOT_FOUND));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public ApplicationSubmissionResponse apply(long siteUserId, ApplyRequest applyRe
Long secondChoiceUnivApplyInfoId = univApplyInfoChoiceRequest.secondChoiceUnivApplyInfoId();
Long thirdChoiceUnivApplyInfoId = univApplyInfoChoiceRequest.thirdChoiceUnivApplyInfoId();

Optional<Application> existingApplication = applicationRepository.findBySiteUserIdAndTermId(siteUser.getId(), term.getId());
Optional<Application> existingApplication =
applicationRepository.findTopBySiteUserIdAndTermIdAndIsDeleteFalseOrderByIdDesc(siteUser.getId(), term.getId());
int updateCount = existingApplication
.map(application -> {
validateUpdateLimitNotExceed(application);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public UnivApplyInfoDetailResponse getUnivApplyInfoDetail(Long univApplyInfoId)
}

@Transactional(readOnly = true)
@ThunderingHerdCaching(key = "univApplyInfoTextSearch:{0}", cacheManager = "customCacheManager", ttlSec = 86400)
// todo: 현재 레디스 관련 에러 발생중으로 임시 주석처리, 추후 원인 분석 후 적용 필요
// @ThunderingHerdCaching(key = "univApplyInfoTextSearch:{0}", cacheManager = "customCacheManager", ttlSec = 86400)
public UnivApplyInfoPreviewResponses searchUnivApplyInfoByText(String text) {
Term term = termRepository.findByIsCurrentTrue()
.orElseThrow(() -> new CustomException(CURRENT_TERM_NOT_FOUND));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ void setUp() {
ApplicationSubmissionResponse response = applicationSubmissionService.apply(user.getId(), request);

// then
Application savedApplication = applicationRepository.findBySiteUserIdAndTermId(user.getId(), term.getId()).orElseThrow();
Application savedApplication = applicationRepository
.findTopBySiteUserIdAndTermIdAndIsDeleteFalseOrderByIdDesc(user.getId(), term.getId())
.orElseThrow();
assertAll(
() -> assertThat(response.totalApplyCount())
.isEqualTo(APPLICATION_UPDATE_COUNT_LIMIT),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ class 각각의_검색_대상에_대해_검색한다 {
);
}

@Test
// todo: 현재 레디스 관련 에러 발생중으로 임시 주석처리, 추후 원인 분석 후 적용 필요
// @Test
void 캐시가_적용된다() {
// given
String text = "Guam";
Expand Down