From 4d2de4fb9425549863b130e9b70cbdde5ed19a41 Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Thu, 14 Nov 2024 16:50:15 +0900 Subject: [PATCH 1/5] =?UTF-8?q?[feat]=20playground=20coffee=20chat=20repon?= =?UTF-8?q?se=20dto=20=EC=83=9D=EC=84=B1=20(#435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../playground/PlaygroundClient.java | 4 ++++ .../dto/PlayGroundCoffeeChatResponse.java | 18 ++++++++++++++++++ .../dto/PlayGroundCoffeeChatWrapper.java | 10 ++++++++++ 3 files changed, 32 insertions(+) create mode 100644 src/main/java/org/sopt/app/application/playground/dto/PlayGroundCoffeeChatResponse.java create mode 100644 src/main/java/org/sopt/app/application/playground/dto/PlayGroundCoffeeChatWrapper.java diff --git a/src/main/java/org/sopt/app/application/playground/PlaygroundClient.java b/src/main/java/org/sopt/app/application/playground/PlaygroundClient.java index a9ae93de..7952de3f 100755 --- a/src/main/java/org/sopt/app/application/playground/PlaygroundClient.java +++ b/src/main/java/org/sopt/app/application/playground/PlaygroundClient.java @@ -7,6 +7,7 @@ import java.util.List; import java.util.Map; import org.sopt.app.application.auth.dto.PlaygroundAuthTokenInfo.RefreshedToken; +import org.sopt.app.application.playground.dto.PlayGroundCoffeeChatWrapper; import org.sopt.app.application.playground.dto.PlayGroundEmploymentResponse; import org.sopt.app.application.playground.dto.PlaygroundPostInfo.PlaygroundPostResponse; import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.ActiveUserIds; @@ -58,4 +59,7 @@ PlayGroundEmploymentResponse getPlaygroundEmploymentPost(@HeaderMap Map headers); } diff --git a/src/main/java/org/sopt/app/application/playground/dto/PlayGroundCoffeeChatResponse.java b/src/main/java/org/sopt/app/application/playground/dto/PlayGroundCoffeeChatResponse.java new file mode 100644 index 00000000..d6e425b6 --- /dev/null +++ b/src/main/java/org/sopt/app/application/playground/dto/PlayGroundCoffeeChatResponse.java @@ -0,0 +1,18 @@ +package org.sopt.app.application.playground.dto; + +import java.util.List; + +public record PlayGroundCoffeeChatResponse( + Long memberId, + String bio, + List topicTypeList, + String profileImage, + String name, + String career, + String organization, + String companyJob, + List soptActivities, + boolean isMine, + boolean isBlind +) { +} \ No newline at end of file diff --git a/src/main/java/org/sopt/app/application/playground/dto/PlayGroundCoffeeChatWrapper.java b/src/main/java/org/sopt/app/application/playground/dto/PlayGroundCoffeeChatWrapper.java new file mode 100644 index 00000000..154294a4 --- /dev/null +++ b/src/main/java/org/sopt/app/application/playground/dto/PlayGroundCoffeeChatWrapper.java @@ -0,0 +1,10 @@ +package org.sopt.app.application.playground.dto; + +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +public record PlayGroundCoffeeChatWrapper( + @JsonProperty("coffeeChatList") + List coffeeChatList +) { +} \ No newline at end of file From b215793733d01cb6d8f8caa99e5fa1277b1bdfd0 Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Thu, 14 Nov 2024 16:50:41 +0900 Subject: [PATCH 2/5] =?UTF-8?q?[feat]=20CoffeeChatList=20=EB=B0=98?= =?UTF-8?q?=ED=99=98=20API=20(#435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../playground/PlaygroundAuthService.java | 40 ++++++++++++++----- .../app/presentation/home/HomeController.java | 20 +++++++++- .../home/response/CoffeeChatResponse.java | 36 +++++++++++++++++ 3 files changed, 86 insertions(+), 10 deletions(-) create mode 100644 src/main/java/org/sopt/app/presentation/home/response/CoffeeChatResponse.java 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 ce1ac8b5..ac27605d 100755 --- a/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java +++ b/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java @@ -1,21 +1,36 @@ package org.sopt.app.application.playground; -import static org.sopt.app.application.playground.PlaygroundHeaderCreator.*; +import static org.sopt.app.application.playground.PlaygroundHeaderCreator.createAuthorizationHeaderByUserPlaygroundToken; +import static org.sopt.app.application.playground.PlaygroundHeaderCreator.createDefaultHeader; -import lombok.*; import io.jsonwebtoken.ExpiredJwtException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; -import java.util.*; +import java.util.Collections; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; -import org.sopt.app.application.playground.dto.PlayGroundEmploymentResponse; -import org.sopt.app.application.playground.dto.PlaygroundPostInfo.*; -import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.*; +import lombok.RequiredArgsConstructor; +import lombok.val; import org.sopt.app.application.auth.dto.PlaygroundAuthTokenInfo.RefreshedToken; -import org.sopt.app.common.exception.*; +import org.sopt.app.application.playground.dto.PlayGroundEmploymentResponse; +import org.sopt.app.application.playground.dto.PlaygroundPostInfo.PlaygroundPost; +import org.sopt.app.application.playground.dto.PlaygroundPostInfo.PlaygroundPostResponse; +import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.ActiveUserIds; +import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.ActivityCardinalInfo; +import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.MainView; +import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.MainViewUser; +import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.OwnPlaygroundProfile; +import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.PlaygroundMain; +import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.PlaygroundProfile; +import org.sopt.app.application.playground.dto.PlaygroundProfileInfo.UserActiveInfo; +import org.sopt.app.common.exception.BadRequestException; +import org.sopt.app.common.exception.UnauthorizedException; import org.sopt.app.common.response.ErrorCode; import org.sopt.app.domain.enums.UserStatus; -import org.sopt.app.presentation.auth.AppAuthRequest.*; +import org.sopt.app.presentation.auth.AppAuthRequest.AccessTokenRequest; +import org.sopt.app.presentation.auth.AppAuthRequest.CodeRequest; +import org.sopt.app.presentation.home.response.CoffeeChatResponse; import org.sopt.app.presentation.home.response.EmploymentPostResponse; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -166,7 +181,14 @@ public List getPlaygroundEmploymentPost(String accessTok PlayGroundEmploymentResponse postInfo = playgroundClient.getPlaygroundEmploymentPost(requestHeader,16,10,0); return postInfo.posts().stream() .map(EmploymentPostResponse::of) - .collect(Collectors.toList()); + .toList(); } + public List getCoffeeChatList(String accessToken) { + Map headers = PlaygroundHeaderCreator.createAuthorizationHeaderByUserPlaygroundToken(accessToken); + return playgroundClient.getCoffeeChatList(headers).coffeeChatList().stream() + .filter(member -> !member.isBlind()) + .map(CoffeeChatResponse::of) + .toList(); + } } diff --git a/src/main/java/org/sopt/app/presentation/home/HomeController.java b/src/main/java/org/sopt/app/presentation/home/HomeController.java index 51cd9f23..ebed92ec 100644 --- a/src/main/java/org/sopt/app/presentation/home/HomeController.java +++ b/src/main/java/org/sopt/app/presentation/home/HomeController.java @@ -10,10 +10,13 @@ import org.sopt.app.application.app_service.dto.AppServiceEntryStatusResponse; import org.sopt.app.domain.entity.User; import org.sopt.app.facade.HomeFacade; +import org.sopt.app.presentation.home.response.CoffeeChatResponse; import org.sopt.app.presentation.home.response.EmploymentPostResponse; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; @RestController @RequiredArgsConstructor @@ -67,4 +70,19 @@ public ResponseEntity> getEmploymentPosts( homeFacade.getHomeEmploymentPost(user) ); } + + @Operation(summary = "커피챗 리스트 조회") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "success"), + @ApiResponse(responseCode = "401", description = "token error", content = @Content), + @ApiResponse(responseCode = "500", description = "server error", content = @Content) + }) + @GetMapping("/coffeechat") + public ResponseEntity> getCoffeeChatList( + @AuthenticationPrincipal User user + ) { + return ResponseEntity.ok( + homeFacade.getCoffeeChatList(user) + ); + } } 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 new file mode 100644 index 00000000..c8f66101 --- /dev/null +++ b/src/main/java/org/sopt/app/presentation/home/response/CoffeeChatResponse.java @@ -0,0 +1,36 @@ +package org.sopt.app.presentation.home.response; + +import java.util.List; +import lombok.Builder; +import lombok.Getter; +import org.sopt.app.application.playground.dto.PlayGroundCoffeeChatResponse; + +@Getter +@Builder +public class CoffeeChatResponse { + private Long memberId; + private String bio; + private List topicTypeList; + private String profileImage; + private String name; + private String career; + private String organization; + private String companyJob; + private List soptActivities; + private boolean isMine; + private boolean isBlind; + + public static CoffeeChatResponse of(PlayGroundCoffeeChatResponse playGroundCoffeeChatResponse){ + return CoffeeChatResponse.builder() + .memberId(playGroundCoffeeChatResponse.memberId()) + .bio(playGroundCoffeeChatResponse.bio()) + .topicTypeList(playGroundCoffeeChatResponse.topicTypeList()) + .profileImage(playGroundCoffeeChatResponse.profileImage()) + .name(playGroundCoffeeChatResponse.name()) + .career(playGroundCoffeeChatResponse.career()) + .organization(playGroundCoffeeChatResponse.organization()) + .companyJob(playGroundCoffeeChatResponse.companyJob()) + .soptActivities(playGroundCoffeeChatResponse.soptActivities()) + .build(); + } +} \ No newline at end of file From 8d80a34ff76f58ab399386e2c2776a51312de954 Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Thu, 14 Nov 2024 16:51:13 +0900 Subject: [PATCH 3/5] =?UTF-8?q?[feat]=20coffeeChatList=20=EB=B0=98?= =?UTF-8?q?=ED=99=98=20API=20(#435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/org/sopt/app/facade/HomeFacade.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/sopt/app/facade/HomeFacade.java b/src/main/java/org/sopt/app/facade/HomeFacade.java index 13734939..2577e959 100755 --- a/src/main/java/org/sopt/app/facade/HomeFacade.java +++ b/src/main/java/org/sopt/app/facade/HomeFacade.java @@ -3,16 +3,18 @@ import java.util.List; import lombok.RequiredArgsConstructor; import lombok.val; -import org.sopt.app.application.app_service.*; +import org.sopt.app.application.app_service.AppServiceBadgeService; +import org.sopt.app.application.app_service.AppServiceService; import org.sopt.app.application.app_service.dto.AppServiceEntryStatusResponse; import org.sopt.app.application.app_service.dto.AppServiceInfo; -import org.sopt.app.application.home.ActivityDurationCalculator; -import org.sopt.app.application.playground.PlaygroundAuthService; import org.sopt.app.application.description.DescriptionInfo.MainDescription; import org.sopt.app.application.description.DescriptionService; +import org.sopt.app.application.home.ActivityDurationCalculator; +import org.sopt.app.application.playground.PlaygroundAuthService; import org.sopt.app.domain.entity.User; import org.sopt.app.domain.enums.UserStatus; import org.sopt.app.presentation.home.HomeDescriptionResponse; +import org.sopt.app.presentation.home.response.CoffeeChatResponse; import org.sopt.app.presentation.home.response.EmploymentPostResponse; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -73,4 +75,8 @@ public List getHomeEmploymentPost(User user) { return playgroundAuthService.getPlaygroundEmploymentPost(user.getPlaygroundToken()); } + @Transactional(readOnly = true) + public List getCoffeeChatList(User user) { + return playgroundAuthService.getCoffeeChatList(user.getPlaygroundToken()); + } } From 6683d84370cf680629d8dd32f9433614ae65cd9e Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Thu, 14 Nov 2024 16:57:43 +0900 Subject: [PATCH 4/5] =?UTF-8?q?[del]=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=A0=9C=EA=B1=B0=20?= =?UTF-8?q?(#435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/app/presentation/home/response/CoffeeChatResponse.java | 2 -- 1 file changed, 2 deletions(-) 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 c8f66101..2a0bff27 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 @@ -17,8 +17,6 @@ public class CoffeeChatResponse { private String organization; private String companyJob; private List soptActivities; - private boolean isMine; - private boolean isBlind; public static CoffeeChatResponse of(PlayGroundCoffeeChatResponse playGroundCoffeeChatResponse){ return CoffeeChatResponse.builder() From 3334d5a4d1a3d0bff08ab266a4549a102d613d0b Mon Sep 17 00:00:00 2001 From: rlarlgnszx Date: Thu, 21 Nov 2024 17:27:59 +0900 Subject: [PATCH 5/5] =?UTF-8?q?[fix]=20requestParam=EC=B6=94=EA=B0=80=20(#?= =?UTF-8?q?435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/sopt/app/presentation/home/HomeController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/sopt/app/presentation/home/HomeController.java b/src/main/java/org/sopt/app/presentation/home/HomeController.java index 1aed919c..7e7c285c 100644 --- a/src/main/java/org/sopt/app/presentation/home/HomeController.java +++ b/src/main/java/org/sopt/app/presentation/home/HomeController.java @@ -12,12 +12,13 @@ import org.sopt.app.domain.entity.User; import org.sopt.app.facade.HomeFacade; import org.sopt.app.presentation.home.response.CoffeeChatResponse; -import org.sopt.app.presentation.home.response.RecentPostsResponse; import org.sopt.app.presentation.home.response.EmploymentPostResponse; +import org.sopt.app.presentation.home.response.RecentPostsResponse; import org.springframework.http.ResponseEntity; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController