Skip to content

Commit

Permalink
Merge pull request #153 from goalSetter09/10th-Kampus-BE-152
Browse files Browse the repository at this point in the history
[FIX] 트랜딩 게시판 제한 3개로 변경, boardId 추가
  • Loading branch information
goalSetter09 authored Feb 20, 2025
2 parents bd69386 + eba2872 commit b0d5f3e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public List<TrendingPostPreview> toTrendingPostPreviews(List<Post> posts) {
.map(post -> {
PostPhoto postPhoto = postPhotoRepository.findFirstByPostIdOrderByCreatedTime(post.getId())
.orElse(null);
return TrendingPostPreview.from(post, boardNameMap.get(post.getBoardId()), postPhoto);
return TrendingPostPreview.from(post, post.getBoardId(), boardNameMap.get(post.getBoardId()),
postPhoto);
})
.toList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class TrendingPostAppender {
public void appendTrendingPost(Long postId) {
Post post = postFinder.getPost(postId);

if (post.getLikes() >= 10) {
if (post.getLikes() >= 3) {
TrendingPost trendingPost = TrendingPost.builder()
.postId(postId)
.boardId(post.getBoardId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@

public record TrendingPostPreview(
Long postId,
Long boardId,
String boardName,
String title,
String content,
Long likes,
Long comments,
String thumbnailUrl
) {
public static TrendingPostPreview from(Post post, String boardName, PostPhoto postPhoto) {
public static TrendingPostPreview from(Post post, Long boardId, String boardName, PostPhoto postPhoto) {
return new TrendingPostPreview(
post.getId(),
boardId,
boardName,
post.getTitle(),
post.getContent(),
Expand Down

0 comments on commit b0d5f3e

Please sign in to comment.