From 5cc119fff32e89205d57c0d7f7f72fff1c795718 Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Sat, 30 Nov 2024 18:44:14 +0900 Subject: [PATCH] =?UTF-8?q?[modify]=20=EC=BB=A4=ED=94=BC=EC=B1=97=20API=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20(#462)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../playground/PlaygroundAuthService.java | 14 ++++++++++++-- .../home/response/CoffeeChatResponse.java | 13 ++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java b/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java index b47089d2..5df1a612 100755 --- a/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java +++ b/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java @@ -19,6 +19,7 @@ import lombok.RequiredArgsConstructor; import lombok.val; import org.sopt.app.application.auth.dto.PlaygroundAuthTokenInfo.RefreshedToken; +import org.sopt.app.application.playground.dto.PlayGroundCoffeeChatResponse; import org.sopt.app.application.playground.dto.PlayGroundEmploymentResponse; import org.sopt.app.application.playground.dto.PlayGroundPostCategory; import org.sopt.app.application.playground.dto.PlayGroundPostDetailResponse; @@ -209,7 +210,7 @@ public List getRecentPostsWithMemberInfo(String playgroundT List recentPosts = getRecentPosts(playgroundToken); return getPostsWithMemberInfo(playgroundToken, recentPosts); } - + public List getPlaygroundEmploymentPost(String accessToken) { Map requestHeader = createAuthorizationHeaderByUserPlaygroundToken(accessToken); PlayGroundEmploymentResponse postInfo = playgroundClient.getPlaygroundEmploymentPost(requestHeader,16,10,0); @@ -222,10 +223,12 @@ public List getCoffeeChatList(String accessToken) { Map headers = PlaygroundHeaderCreator.createAuthorizationHeaderByUserPlaygroundToken(accessToken); return playgroundClient.getCoffeeChatList(headers).coffeeChatList().stream() .filter(member -> !member.isBlind()) - .map(CoffeeChatResponse::of) + .map(i -> CoffeeChatResponse.of(i, getCurrentActivity(i))) .toList(); } + + public List getPlaygroundEmploymentPostWithMemberInfo(String playgroundToken) { List employmentPosts = getPlaygroundEmploymentPost(playgroundToken); return getPostsWithMemberInfo(playgroundToken, employmentPosts); @@ -250,4 +253,11 @@ private List getPostsWithMemberInfo(String pla } return mutablePosts; } + + private String getCurrentActivity(PlayGroundCoffeeChatResponse playGroundCoffeeChatResponse) { + return playGroundCoffeeChatResponse.soptActivities().stream() + .filter(activity -> activity.contains(currentGeneration.toString())) + .findFirst() + .orElse(null); + } } diff --git a/src/main/java/org/sopt/app/presentation/home/response/CoffeeChatResponse.java b/src/main/java/org/sopt/app/presentation/home/response/CoffeeChatResponse.java index 2a0bff27..5da65acc 100644 --- a/src/main/java/org/sopt/app/presentation/home/response/CoffeeChatResponse.java +++ b/src/main/java/org/sopt/app/presentation/home/response/CoffeeChatResponse.java @@ -1,5 +1,6 @@ package org.sopt.app.presentation.home.response; +import java.util.ArrayList; import java.util.List; import lombok.Builder; import lombok.Getter; @@ -17,18 +18,24 @@ public class CoffeeChatResponse { private String organization; private String companyJob; private List soptActivities; + private String currentSoptActivity; - public static CoffeeChatResponse of(PlayGroundCoffeeChatResponse playGroundCoffeeChatResponse){ + public static CoffeeChatResponse of(PlayGroundCoffeeChatResponse playGroundCoffeeChatResponse, String currentSoptActivity) { + List updatedSoptActivities = new ArrayList<>(playGroundCoffeeChatResponse.soptActivities()); + if (currentSoptActivity != null) { + updatedSoptActivities.remove(currentSoptActivity); + } return CoffeeChatResponse.builder() .memberId(playGroundCoffeeChatResponse.memberId()) .bio(playGroundCoffeeChatResponse.bio()) .topicTypeList(playGroundCoffeeChatResponse.topicTypeList()) .profileImage(playGroundCoffeeChatResponse.profileImage()) .name(playGroundCoffeeChatResponse.name()) - .career(playGroundCoffeeChatResponse.career()) + .career(playGroundCoffeeChatResponse.career().equals("아직 없어요") ? null : playGroundCoffeeChatResponse.career()) .organization(playGroundCoffeeChatResponse.organization()) .companyJob(playGroundCoffeeChatResponse.companyJob()) - .soptActivities(playGroundCoffeeChatResponse.soptActivities()) + .soptActivities(updatedSoptActivities) + .currentSoptActivity(currentSoptActivity) .build(); } } \ No newline at end of file