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 @@ -29,7 +29,7 @@ public interface CommunityPostRepository
ORDER BY COUNT(cpl.id) DESC, cp.viewCount DESC
LIMIT 3
""")
List<CommunityPost> findTop3ByLikesSince72Hours(@Param("since") LocalDateTime since);
List<CommunityPost> findTop3ByLikesSince7Days(@Param("since") LocalDateTime since);

@EntityGraph(attributePaths = {"communityPostImageList"})
Page<CommunityPost> findAllByCategory(Category category, Pageable pageable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ public CommentResponse postCommentAndReply(

@Cacheable(value = "community-popular-posts", unless = "#result == null")
public CommunityPostPopularWrappingResponse getPopularCommunityPosts() {
LocalDateTime since72Hours = LocalDateTime.now().minusHours(72);
LocalDateTime since7Days = LocalDateTime.now().minusDays(7);

List<CommunityPostPopularResponse> list =
communityPostRepository.findTop3ByLikesSince72Hours(since72Hours).stream()
communityPostRepository.findTop3ByLikesSince7Days(since7Days).stream()
.map(CommunityPostPopularResponse::from)
.toList();
return new CommunityPostPopularWrappingResponse(List.copyOf(list));
Expand Down