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 0b5e8c3f..b47089d2 100755 --- a/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java +++ b/src/main/java/org/sopt/app/application/playground/PlaygroundAuthService.java @@ -7,6 +7,7 @@ import jakarta.persistence.EntityNotFoundException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -38,6 +39,7 @@ import org.sopt.app.domain.enums.UserStatus; 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.sopt.app.presentation.home.response.RecentPostsResponse; import org.springframework.beans.factory.annotation.Value; @@ -212,7 +214,16 @@ public List getPlaygroundEmploymentPost(String accessTok Map requestHeader = createAuthorizationHeaderByUserPlaygroundToken(accessToken); PlayGroundEmploymentResponse postInfo = playgroundClient.getPlaygroundEmploymentPost(requestHeader,16,10,0); return postInfo.posts().stream() - .map(EmploymentPostResponse::of).toList(); + .map(EmploymentPostResponse::of) + .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(); } public List getPlaygroundEmploymentPostWithMemberInfo(String playgroundToken) { 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 4cfd98f5..28f6accf 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.PlayGroundPostDetailResponse; import org.sopt.app.application.playground.dto.PlaygroundPostInfo.PlaygroundPostResponse; @@ -63,6 +64,9 @@ PlayGroundEmploymentResponse getPlaygroundEmploymentPost(@HeaderMap Map headers); + @RequestLine("GET /api/v1/community/posts/{postId}") PlayGroundPostDetailResponse getPlayGroundPostDetail(@HeaderMap Map headers, @Param Long postId); 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 diff --git a/src/main/java/org/sopt/app/facade/HomeFacade.java b/src/main/java/org/sopt/app/facade/HomeFacade.java index 1902adc1..21162b19 100755 --- a/src/main/java/org/sopt/app/facade/HomeFacade.java +++ b/src/main/java/org/sopt/app/facade/HomeFacade.java @@ -5,16 +5,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.RecentPostsResponse; import org.sopt.app.presentation.home.response.EmploymentPostResponse; import org.springframework.stereotype.Service; @@ -80,4 +82,8 @@ public List getHomeEmploymentPost(User user) { return playgroundAuthService.getPlaygroundEmploymentPostWithMemberInfo(user.getPlaygroundToken()); } + @Transactional(readOnly = true) + public List getCoffeeChatList(User user) { + return playgroundAuthService.getCoffeeChatList(user.getPlaygroundToken()); + } } 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 8729ba33..7e7c285c 100644 --- a/src/main/java/org/sopt/app/presentation/home/HomeController.java +++ b/src/main/java/org/sopt/app/presentation/home/HomeController.java @@ -11,11 +11,15 @@ import org.sopt.app.application.meeting.MeetingResponse; import org.sopt.app.domain.entity.User; import org.sopt.app.facade.HomeFacade; -import org.sopt.app.presentation.home.response.RecentPostsResponse; +import org.sopt.app.presentation.home.response.CoffeeChatResponse; 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.*; +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 @RequiredArgsConstructor @@ -85,6 +89,21 @@ public ResponseEntity> getEmploymentPosts( ); } + @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) + ); + } + @Operation(summary = "전체 모임 확인") @ApiResponses({ @ApiResponse(responseCode = "200", description = "success"), 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..2a0bff27 --- /dev/null +++ b/src/main/java/org/sopt/app/presentation/home/response/CoffeeChatResponse.java @@ -0,0 +1,34 @@ +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; + + 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