Skip to content

Commit

Permalink
Merge branch 'dev' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
gouyeonch committed Oct 22, 2024
2 parents 9ba7100 + 55f4623 commit 6cfa473
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public enum ErrorCode {
NOT_FOUND_REPORTED_COMMENT("40416", HttpStatus.NOT_FOUND, "신고 댓글 내역이 존재하지 않습니다."),
NOT_FOUND_ADMIN("40417", HttpStatus.NOT_FOUND, "해당 관리자가 존재하지 않습니다."),
NOT_FOUND_REPORTED_NEWS("40418", HttpStatus.NOT_FOUND, "신고 뉴스 내역이 존재하지 않습니다."),
NOT_FOUND_NEWS_HIST("40419", HttpStatus.NOT_FOUND, "해당 뉴스 시청 기록이 존재하지 않습니다."),

// UnsupportedMediaType Error
UNSUPPORTED_MEDIA_TYPE("41500", HttpStatus.UNSUPPORTED_MEDIA_TYPE, "허용되지 않은 파일 형식입니다."),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public CursorResponseDto<List<NewsHistInfoDto>> getNewsWithHist(Long userId, Lon
results = newsViewHistRepository.findAllByUserAndCursorFirst(userId, pageRequest);
} else {
// 커서 아이디에 해당하는 뉴스가 있는지 검사
if (!newsLookupService.existNewsById(cursorId)) {
if (!newsViewHistService.existNewsViewHistById(cursorId)) {
throw new CommonException(ErrorCode.NOT_FOUND_CURSOR);
}
log.info("cursorId: " + cursorId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,13 @@ public void updateNewsHist(Long userId) {
redisService.deleteNewsAllViewHistory(userId);
}
} // 레디스로 부터 해당 유저의 뉴스 시청기록 디비에 동기화

public NewsViewHist findNewsViewHistById(Long histId) {
return newsViewHistRepository.findById(histId)
.orElseThrow(() -> new CommonException(ErrorCode.NOT_FOUND_NEWS_HIST));
}

public Boolean existNewsViewHistById(Long histId) {
return newsViewHistRepository.existsById(histId);
}
}

0 comments on commit 6cfa473

Please sign in to comment.