From 320cc0ea57969ef173db11a744ce23bec3794b0e Mon Sep 17 00:00:00 2001 From: joonghyun Date: Thu, 6 Jun 2024 10:48:48 +0900 Subject: [PATCH] =?UTF-8?q?#88=20fix:=20=EC=95=A8=EB=B2=94=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C=20=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=EC=9E=90=EB=A5=BC=20=ED=8F=AC=ED=95=A8=ED=95=B4=20=EB=A9=A4?= =?UTF-8?q?=EB=B2=84=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EB=A5=BC=20=EB=B0=98?= =?UTF-8?q?=ED=99=98=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lesso/neverland/album/dto/AlbumByTimeDto.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/lesso/neverland/album/dto/AlbumByTimeDto.java b/src/main/java/com/lesso/neverland/album/dto/AlbumByTimeDto.java index f08502a..c111ea2 100644 --- a/src/main/java/com/lesso/neverland/album/dto/AlbumByTimeDto.java +++ b/src/main/java/com/lesso/neverland/album/dto/AlbumByTimeDto.java @@ -2,6 +2,7 @@ import com.lesso.neverland.album.domain.Album; +import java.util.ArrayList; import java.util.List; public record AlbumByTimeDto(Long albumIdx, @@ -11,7 +12,18 @@ public record AlbumByTimeDto(Long albumIdx, String puzzleDate, Integer puzzlerCount, List puzzlerImageList) { + + public static AlbumByTimeDto from(Album album) { + List puzzlerImageList = new ArrayList<>(); + puzzlerImageList.add(album.getPuzzle().getUser().getProfile().getProfileImage()); + + puzzlerImageList.addAll( + album.getPuzzle().getPuzzleMembers().stream() + .map(puzzleMember -> puzzleMember.getUser().getProfile().getProfileImage()) + .limit(2) + .toList()); + return new AlbumByTimeDto( album.getAlbumIdx(), album.getPuzzle().getTitle(), @@ -19,8 +31,7 @@ public static AlbumByTimeDto from(Album album) { album.getAlbumImage(), album.getPuzzle().getPuzzleDate().toString(), album.getPuzzle().getPuzzleMembers().size(), - album.getPuzzle().getPuzzleMembers().stream() - .map(puzzleMember -> puzzleMember.getUser().getProfile().getProfileImage()).toList() + puzzlerImageList ); } }