From 4b158ee5c6e82666edeed8eee1229c62581963a5 Mon Sep 17 00:00:00 2001 From: joonghyun Date: Wed, 5 Jun 2024 23:40:56 +0900 Subject: [PATCH 1/5] =?UTF-8?q?#122=20fix:=20=EA=B7=B8=EB=A3=B9=20?= =?UTF-8?q?=EB=A9=A4=EB=B2=84=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=8B=9C=20=EA=B4=80=EB=A6=AC=EC=9E=90=EA=B0=80=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=EB=90=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C?= =?UTF-8?q?=EB=A5=BC=20=EC=88=98=EC=A0=95=ED=95=98=EA=B3=A0=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=EC=9E=90=EA=B0=80=20=EA=B0=80=EC=9E=A5=20=EC=95=9E?= =?UTF-8?q?=EC=97=90=20=EB=8B=B4=EA=B8=B0=EB=8F=84=EB=A1=9D=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lesso/neverland/group/application/GroupService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/lesso/neverland/group/application/GroupService.java b/src/main/java/com/lesso/neverland/group/application/GroupService.java index c0ba547..7503756 100644 --- a/src/main/java/com/lesso/neverland/group/application/GroupService.java +++ b/src/main/java/com/lesso/neverland/group/application/GroupService.java @@ -112,13 +112,14 @@ private List getMemberImageList(Team group) { List memberImages = group.getUserTeams().stream() .filter(userTeam -> "active".equals(userTeam.getStatus())) + .filter(userTeam -> !userTeam.getUser().equals(group.getAdmin())) .map(userTeam -> userTeam.getUser().getProfile().getProfileImage()) - .limit(2).toList(); + .limit(2) + .toList(); imageList.addAll(memberImages); return imageList; } - // [관리자] 그룹 수정 화면 조회 public BaseResponse getGroupEditView(Long groupIdx) { Team group = groupRepository.findById(groupIdx).orElseThrow(() -> new BaseException(INVALID_GROUP_IDX)); From 1de70c1fdd93a89f798ff64cf732b98750f85a8c Mon Sep 17 00:00:00 2001 From: joonghyun Date: Thu, 6 Jun 2024 09:43:31 +0900 Subject: [PATCH 2/5] =?UTF-8?q?#87=20fix:=20=ED=8D=BC=EC=A6=90=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=8B=9C=20=EC=9D=B4=EB=AF=B8=EC=A7=80=EA=B0=80=20?= =?UTF-8?q?=EC=97=86=EB=8A=94=20=EA=B2=BD=EC=9A=B0=EB=8F=84=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=EC=9D=B4=20=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84?= =?UTF-8?q?=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 --- .../com/lesso/neverland/puzzle/application/PuzzleService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/lesso/neverland/puzzle/application/PuzzleService.java b/src/main/java/com/lesso/neverland/puzzle/application/PuzzleService.java index b1a776d..5c1a110 100644 --- a/src/main/java/com/lesso/neverland/puzzle/application/PuzzleService.java +++ b/src/main/java/com/lesso/neverland/puzzle/application/PuzzleService.java @@ -146,7 +146,7 @@ public BaseResponse createPuzzle(Long groupIdx, MultipartF LocalDate puzzleDate = convertToLocalDate(createPuzzleRequest.puzzleDate()); Puzzle newPuzzle = createPuzzle(createPuzzleRequest, group, writer, puzzleDate); - if (!image.isEmpty()) { + if (image != null && !image.isEmpty()) { String imagePath = imageService.uploadImage("puzzle", image); newPuzzle.addPuzzleImage(imagePath); } From 86934f0a944fd06db9deb34d98757a80d9310283 Mon Sep 17 00:00:00 2001 From: joonghyun Date: Thu, 6 Jun 2024 10:17:27 +0900 Subject: [PATCH 3/5] =?UTF-8?q?#87=20fix:=20=ED=8D=BC=EC=A6=90=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=8B=9C=20status=EA=B0=92=EC=9D=84=20active?= =?UTF-8?q?=EB=A1=9C=20=EC=A0=80=EC=9E=A5=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/lesso/neverland/puzzle/domain/Puzzle.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/lesso/neverland/puzzle/domain/Puzzle.java b/src/main/java/com/lesso/neverland/puzzle/domain/Puzzle.java index 6d1dda8..8864ad6 100644 --- a/src/main/java/com/lesso/neverland/puzzle/domain/Puzzle.java +++ b/src/main/java/com/lesso/neverland/puzzle/domain/Puzzle.java @@ -13,6 +13,7 @@ import java.util.ArrayList; import java.util.List; +import static com.lesso.neverland.common.constants.Constants.ACTIVE; import static com.lesso.neverland.common.constants.Constants.INACTIVE; @Entity @@ -62,6 +63,7 @@ public Puzzle(User user, Team team, String title, String content, LocalDate puzz this.content = content; this.puzzleDate = puzzleDate; this.location = location; + this.setStatus(ACTIVE); } public void setUser(User user) { From 320cc0ea57969ef173db11a744ce23bec3794b0e Mon Sep 17 00:00:00 2001 From: joonghyun Date: Thu, 6 Jun 2024 10:48:48 +0900 Subject: [PATCH 4/5] =?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 ); } } From 7f2692993ba65cca2fca2a99d13816eb81fd522b Mon Sep 17 00:00:00 2001 From: joonghyun Date: Thu, 6 Jun 2024 11:11:58 +0900 Subject: [PATCH 5/5] =?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=EC=B0=B8=EC=97=AC?= =?UTF-8?q?=20=EB=A9=A4=EB=B2=84=EC=97=90=20=EA=B4=80=EB=A6=AC=EC=9E=90=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../album/application/AlbumService.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/lesso/neverland/album/application/AlbumService.java b/src/main/java/com/lesso/neverland/album/application/AlbumService.java index dfefe53..54e413b 100644 --- a/src/main/java/com/lesso/neverland/album/application/AlbumService.java +++ b/src/main/java/com/lesso/neverland/album/application/AlbumService.java @@ -14,6 +14,7 @@ import org.springframework.web.multipart.MultipartFile; import java.io.IOException; +import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -47,9 +48,6 @@ public BaseResponse getAlbumDetail(Long groupIdx, Long albu Album album = albumRepository.findById(albumIdx).orElseThrow(() -> new BaseException(INVALID_ALBUM_IDX)); if (!album.getPuzzle().getTeam().equals(group)) throw new BaseException(NO_GROUP_ALBUM); - List memberList = album.getPuzzle().getPuzzleMembers().stream() - .map(puzzleMember -> puzzleMember.getUser().getProfile().getNickname()).toList(); - List commentList = album.getComments().stream() .filter(comment -> "active".equals(comment.getStatus())) .map(comment -> new CommentDto( @@ -57,13 +55,25 @@ public BaseResponse getAlbumDetail(Long groupIdx, Long albu comment.getUser().getProfile().getNickname(), comment.getUser().getProfile().getProfileImage(), comment.getCreatedDate().toString(), - comment.getContent())).toList(); + comment.getContent())) + .toList(); AlbumDetailResponse albumDetailResponse = new AlbumDetailResponse(album.getPuzzle().getTitle(), album.getPuzzle().getPuzzleDate().toString(), - album.getPuzzle().getLocation().getLocation(), memberList, album.getAlbumImage(), album.getContent(), album.getPuzzle().getPuzzleIdx(), commentList); + album.getPuzzle().getLocation().getLocation(), getMemberList(album), album.getAlbumImage(), album.getContent(), album.getPuzzle().getPuzzleIdx(), commentList); return new BaseResponse<>(albumDetailResponse); } + private List getMemberList(Album album) { + List memberList = new ArrayList<>(); + memberList.add(album.getPuzzle().getUser().getProfile().getNickname()); + + memberList.addAll( + album.getPuzzle().getPuzzleMembers().stream() + .map(puzzleMember -> puzzleMember.getUser().getProfile().getNickname()) + .toList()); + return memberList; + } + // 앨범 목록 조회(sortType="time", "location") public BaseResponse getAlbumList(Long groupIdx, String sortType) { Team group = groupRepository.findById(groupIdx).orElseThrow(() -> new BaseException(INVALID_GROUP_IDX));