Skip to content

Commit

Permalink
Merge pull request #192 from lemonssoju/fix/88-getAlbumList
Browse files Browse the repository at this point in the history
[fix/88-getAlbumList] 앨범 목록 조회 시 관리자를 포함해 멤버 이미지를 반환하도록 수정
  • Loading branch information
JoongHyun-Kim authored Jun 6, 2024
2 parents 4d3b0be + 320cc0e commit edb4489
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/main/java/com/lesso/neverland/album/dto/AlbumByTimeDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.lesso.neverland.album.domain.Album;

import java.util.ArrayList;
import java.util.List;

public record AlbumByTimeDto(Long albumIdx,
Expand All @@ -11,16 +12,26 @@ public record AlbumByTimeDto(Long albumIdx,
String puzzleDate,
Integer puzzlerCount,
List<String> puzzlerImageList) {


public static AlbumByTimeDto from(Album album) {
List<String> 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(),
album.getContent(),
album.getAlbumImage(),
album.getPuzzle().getPuzzleDate().toString(),
album.getPuzzle().getPuzzleMembers().size(),
album.getPuzzle().getPuzzleMembers().stream()
.map(puzzleMember -> puzzleMember.getUser().getProfile().getProfileImage()).toList()
puzzlerImageList
);
}
}

0 comments on commit edb4489

Please sign in to comment.