Skip to content

Commit

Permalink
Fix: History의 PrayType.SHARED 인 경우에만 originPrayId 조회하게 수정 (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sion99 authored Mar 13, 2024
2 parents 9c78d1d + f0dd3f4 commit 10047e3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/com/uspray/uspray/service/HistoryService.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,12 @@ public HistoryListResponseDto searchHistoryList(String username,
@Transactional(readOnly = true)
public HistoryDetailResponseDto getHistoryDetail(String username, Long historyId) {
Member member = memberRepository.getMemberByUserId(username);
History history = historyRepository.findById(historyId)
.orElseThrow(() -> new IllegalArgumentException("해당 히스토리가 없습니다. id=" + historyId));
History history = historyRepository.getHistoryById(historyId);
if (!history.getMember().equals(member)) {
throw new NotFoundException(ErrorStatus.HISTORY_NOT_FOUND_EXCEPTION,
ErrorStatus.HISTORY_NOT_FOUND_EXCEPTION.getMessage());
}
if (history.getIsShared()) {
if (history.getPrayType().equals(PrayType.SHARED)) {
Pray originPray = prayRepository.getPrayById(history.getOriginPrayId());
return HistoryDetailResponseDto.shared(history, originPray);
}
Expand Down

0 comments on commit 10047e3

Please sign in to comment.