Skip to content

Commit

Permalink
Fix: 사용자 맞춤 인기글이 5개 미만일 경우 전체 중 인기글 5개 반환하도록 수정(데모데이용)
Browse files Browse the repository at this point in the history
Fix: 사용자 맞춤 인기글이 5개 미만일 경우 전체 중 인기글 5개 반환하도록 수정(데모데이용)
  • Loading branch information
sansan20535 authored Jan 24, 2025
2 parents 9b29d02 + f0af5f4 commit 206e823
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ public PostImagesResponse addPost(final Long memberId, final Long categoryId, fi

@Transactional(readOnly = true)
public PopularPostsResponse getPopularPosts(final Long memberId) {
final List<Post> popularPosts = fetchPopularPosts(memberId);
List<Post> popularPosts = fetchPopularPosts(memberId);
//ToDo: 데모데이 이후 final List<Post> popularPosts로 수정 후 아래 if 문 삭제 필요
if (popularPosts.size() < 5) {
popularPosts = postRepository.findTop5ByLikeCountDesc();
}
return PopularPostsResponse.of(
popularPosts.stream()
.map(popularPost -> PopularPostResponse.of(popularPost.getId(), popularPost.getTitle()))
Expand Down

0 comments on commit 206e823

Please sign in to comment.