From ac15923b9f400def77a0a86da35973d72491c128 Mon Sep 17 00:00:00 2001 From: joonghyun Date: Wed, 5 Jun 2024 21:55:19 +0900 Subject: [PATCH] =?UTF-8?q?#122=20fix:=20=EA=B7=B8=EB=A3=B9=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=ED=95=84=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C=20=ED=98=84?= =?UTF-8?q?=EC=9E=AC=20=EB=A9=A4=EB=B2=84=EB=A7=8C=20=EC=A1=B0=ED=9A=8C?= =?UTF-8?q?=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 --- .../group/application/GroupService.java | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 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 ca3ae7c..b4e27d8 100644 --- a/src/main/java/com/lesso/neverland/group/application/GroupService.java +++ b/src/main/java/com/lesso/neverland/group/application/GroupService.java @@ -88,10 +88,9 @@ private String calculateRecentUpdate(Team group) { // 그룹 프로필 조회 public BaseResponse getGroupProfile(Long groupIdx) { Team group = groupRepository.findById(groupIdx).orElseThrow(() -> new BaseException(INVALID_GROUP_IDX)); - List memberImageList = group.getUserTeams().stream() - .map(userTeam -> userTeam.getUser().getProfile().getProfileImage()) - .limit(3) - .toList(); +// List memberImageList = group.getUserTeams().stream() +// .map(userTeam -> userTeam.getUser().getProfile().getProfileImage()) +// .limit(3).toList(); Integer puzzleCount = puzzleRepository.countByTeam(group); @@ -101,11 +100,23 @@ public BaseResponse getGroupProfile(Long groupIdx) { long dayCount = ChronoUnit.DAYS.between(startLocalDate, today); - GroupProfileResponse profile = new GroupProfileResponse(group.getName(), group.getAdmin().getProfile().getNickname(), group.getStartDate().getYear(), memberImageList, + GroupProfileResponse profile = new GroupProfileResponse(group.getName(), group.getAdmin().getProfile().getNickname(), group.getStartDate().getYear(), getMemberImageList(group), group.getUserTeams().size(), puzzleCount, dayCount); return new BaseResponse<>(profile); } + private List getMemberImageList(Team group) { + List imageList = new ArrayList<>(); + imageList.add(group.getAdmin().getProfile().getProfileImage()); + + List memberImages = group.getUserTeams().stream() + .filter(userTeam -> "active".equals(userTeam.getStatus())) + .map(userTeam -> userTeam.getUser().getProfile().getProfileImage()) + .limit(2).toList(); + imageList.addAll(memberImages); + return imageList; + } + // [관리자] 그룹 수정 화면 조회 public BaseResponse getGroupEditView(Long groupIdx) { @@ -188,8 +199,8 @@ public BaseResponse withdrawGroup(Long groupIdx) { UserTeam userTeam = validateMember(user, group); userTeam.delete(); - userTeam.removeTeam(group); - userTeam.removeUser(user); + //userTeam.removeTeam(group); + //userTeam.removeUser(user); userTeamRepository.save(userTeam); return new BaseResponse<>(SUCCESS);