Skip to content

Commit 10047e3

Browse files
authored
Fix: History의 PrayType.SHARED 인 경우에만 originPrayId 조회하게 수정 (#151)
2 parents 9c78d1d + f0dd3f4 commit 10047e3

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/main/java/com/uspray/uspray/service/HistoryService.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,12 @@ public HistoryListResponseDto searchHistoryList(String username,
7272
@Transactional(readOnly = true)
7373
public HistoryDetailResponseDto getHistoryDetail(String username, Long historyId) {
7474
Member member = memberRepository.getMemberByUserId(username);
75-
History history = historyRepository.findById(historyId)
76-
.orElseThrow(() -> new IllegalArgumentException("해당 히스토리가 없습니다. id=" + historyId));
75+
History history = historyRepository.getHistoryById(historyId);
7776
if (!history.getMember().equals(member)) {
7877
throw new NotFoundException(ErrorStatus.HISTORY_NOT_FOUND_EXCEPTION,
7978
ErrorStatus.HISTORY_NOT_FOUND_EXCEPTION.getMessage());
8079
}
81-
if (history.getIsShared()) {
80+
if (history.getPrayType().equals(PrayType.SHARED)) {
8281
Pray originPray = prayRepository.getPrayById(history.getOriginPrayId());
8382
return HistoryDetailResponseDto.shared(history, originPray);
8483
}

0 commit comments

Comments
 (0)