-
Notifications
You must be signed in to change notification settings - Fork 0
✨️ feat/ZIP-29 : 대시보드 기능 구현 #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
fa49270
✨️ feat/ZIP-29 : 대시보드를 기능 구현
doup2001 3b8e244
♻️ refactor/ZIP-29 : N+1 문제 해결
doup2001 421c9d2
✨️ feat/ZIP-29 : 구현체 정의
doup2001 a3747eb
💡️style/ZIP-29 : 서비스 내 로그 제거
doup2001 36962be
✅test/ZIP-29 : 서비스 및 API 테스트 추가
doup2001 22afa77
Merge branch 'develop' into feat/ZIP-29-DashBoard
doup2001 08dfb81
✅test/ZIP-29 : 서비스 코드 중 변수 수정
doup2001 a93fb89
✅ test/ZIP-29 : 테스트 환경 주입
doup2001 45e1040
✅ test/ZIP-29 : 테스트의 변수 수정
doup2001 01dab61
✨ feat/ZIP-29 : 스웨거 인터페이스 생성
doup2001 5a7bb8c
✨ feat/ZIP-8 : 성능 향상을 위한 테스트 파이프라인 수정
doup2001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
src/main/java/com/zipte/platform/server/adapter/in/web/DashBoardApi.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| package com.zipte.platform.server.adapter.in.web; | ||
|
|
||
| import com.zipte.platform.core.response.ApiResponse; | ||
| import com.zipte.platform.security.oauth2.domain.PrincipalDetails; | ||
| import com.zipte.platform.server.adapter.in.web.dto.response.*; | ||
| import com.zipte.platform.server.adapter.in.web.swagger.DashBoardApiSpec; | ||
| import com.zipte.platform.server.application.in.dashboard.DashBoardUseCase; | ||
| import com.zipte.platform.server.domain.estate.Estate; | ||
| import com.zipte.platform.server.domain.estate.EstatePrice; | ||
| import com.zipte.platform.server.domain.region.Region; | ||
| import com.zipte.platform.server.domain.region.RegionPrice; | ||
| import lombok.RequiredArgsConstructor; | ||
| 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.RestController; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @RestController | ||
| @RequestMapping("/api/v1/dashboard") | ||
| @RequiredArgsConstructor | ||
| public class DashBoardApi implements DashBoardApiSpec { | ||
|
|
||
| private final DashBoardUseCase dashboardService; | ||
|
|
||
| @GetMapping("/region") | ||
| public ApiResponse<List<RegionResponse>> getMyRegion(@AuthenticationPrincipal PrincipalDetails principalDetails) { | ||
|
|
||
| /// 유저 아이디 추출하기 -> AOP로 한번에 처리하기? | ||
| Long userId = principalDetails.getId(); | ||
|
|
||
| List<Region> region = dashboardService.getFavoriteRegion(userId); | ||
|
|
||
| List<RegionResponse> responses = RegionResponse.from(region); | ||
| return ApiResponse.ok(responses); | ||
| } | ||
|
|
||
|
|
||
| @GetMapping("/region/price") | ||
| public ApiResponse<List<RegionPriceResponse>> getMyRegionPrice(@AuthenticationPrincipal PrincipalDetails principalDetails) { | ||
|
|
||
| /// 유저 아이디 추출하기 | ||
| Long userId = principalDetails.getId(); | ||
|
|
||
| List<RegionPrice> regionPrices = dashboardService.getFavoriteRegionPrices(userId); | ||
|
|
||
| List<RegionPriceResponse> responses = RegionPriceResponse.from(regionPrices); | ||
|
|
||
| return ApiResponse.ok(responses); | ||
| } | ||
|
|
||
|
|
||
| @GetMapping("/estate") | ||
| public ApiResponse<List<EstateDetailResponse>> getMyEstate(@AuthenticationPrincipal PrincipalDetails principalDetails) { | ||
|
|
||
| /// 유저 아이디 추출하기 | ||
| Long userId = principalDetails.getId(); | ||
|
|
||
| List<Estate> estates = dashboardService.getFavoriteEstates(userId); | ||
|
|
||
| List<EstateDetailResponse> responses = EstateDetailResponse.from(estates); | ||
|
|
||
| return ApiResponse.ok(responses); | ||
| } | ||
|
|
||
| @GetMapping("/estate/price") | ||
| public ApiResponse<List<EstatePriceListResponse>> getMyEstatePrice(@AuthenticationPrincipal PrincipalDetails principalDetails) { | ||
|
|
||
| /// 유저 아이디 추출하기 | ||
| Long userId = principalDetails.getId(); | ||
|
|
||
| /// 서비스 계층 추출 | ||
| List<EstatePrice> estatePrices = dashboardService.getFavoriteEstatePrice(userId); | ||
|
|
||
| List<EstatePriceListResponse> responses = EstatePriceListResponse.from(estatePrices); | ||
|
|
||
| return ApiResponse.ok(responses); | ||
| } | ||
|
|
||
| @GetMapping("/estate/myhome") | ||
| public ApiResponse<List<EstatePriceListResponse>> getMyHomeEstate(@AuthenticationPrincipal PrincipalDetails principalDetails) { | ||
|
|
||
| /// 유저 아이디 추출하기 | ||
| Long userId = principalDetails.getId(); | ||
|
|
||
| /// 서비스 계층 추출 | ||
| List<EstatePrice> myEstatePrices = dashboardService.getMyEstatePrices(userId); | ||
|
|
||
| /// | ||
| List<EstatePriceListResponse> responses = EstatePriceListResponse.from(myEstatePrices); | ||
|
|
||
| return ApiResponse.ok(responses); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
src/main/java/com/zipte/platform/server/adapter/in/web/swagger/DashBoardApiSpec.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| package com.zipte.platform.server.adapter.in.web.swagger; | ||
|
|
||
| import com.zipte.platform.core.response.ApiResponse; | ||
| import com.zipte.platform.security.oauth2.domain.PrincipalDetails; | ||
| import com.zipte.platform.server.adapter.in.web.dto.response.EstateDetailResponse; | ||
| import com.zipte.platform.server.adapter.in.web.dto.response.EstatePriceListResponse; | ||
| import com.zipte.platform.server.adapter.in.web.dto.response.RegionPriceResponse; | ||
| import com.zipte.platform.server.adapter.in.web.dto.response.RegionResponse; | ||
| import io.swagger.v3.oas.annotations.Operation; | ||
| import io.swagger.v3.oas.annotations.tags.Tag; | ||
| import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @Tag(name = "대시보드 API", description = "대시보드 관련 API") | ||
| public interface DashBoardApiSpec { | ||
|
|
||
| @Operation( | ||
| summary = "나의 관심 지역 목록 조회", | ||
| description = "JWT 를 통해서 나의 관심 지역 목록을 조회합니다." | ||
| ) | ||
| ApiResponse<List<RegionResponse>> getMyRegion( | ||
| @AuthenticationPrincipal PrincipalDetails principalDetails); | ||
|
|
||
|
|
||
| @Operation( | ||
| summary = "나의 관심 지역 가격 조회", | ||
| description = "JWT 를 통해서 나의 관심 지역 가격을 조회합니다. (그래프 생성 데이터 전달)" | ||
| ) | ||
| ApiResponse<List<RegionPriceResponse>> getMyRegionPrice( | ||
| @AuthenticationPrincipal PrincipalDetails principalDetails); | ||
|
|
||
|
|
||
| @Operation( | ||
| summary = "나의 관심 아파트 목록 조회", | ||
| description = "JWT 를 통해서 나의 관심 아파트 목록을 조회합니다." | ||
| ) | ||
| ApiResponse<List<EstateDetailResponse>> getMyEstate( | ||
| @AuthenticationPrincipal PrincipalDetails principalDetails); | ||
|
|
||
|
|
||
| @Operation( | ||
| summary = "나의 관심 아파트 가격 조회", | ||
| description = "JWT 를 통해서 나의 관심 아파트 가격을 조회합니다. (그래프 생성 데이터 전달)" | ||
| ) | ||
| ApiResponse<List<EstatePriceListResponse>> getMyEstatePrice( | ||
| @AuthenticationPrincipal PrincipalDetails principalDetails); | ||
|
|
||
|
|
||
|
|
||
| @Operation( | ||
| summary = "나의 아파트 조회", | ||
| description = "JWT 를 통해서 나의 거주 인증 아파트를 조회합니다. (그래프 생성 데이터 전달)" | ||
| ) | ||
| ApiResponse<List<EstatePriceListResponse>> getMyHomeEstate( | ||
| @AuthenticationPrincipal PrincipalDetails principalDetails); | ||
|
|
||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
사용자 ID 추출 로직의 중복을 개선해주세요.
모든 엔드포인트에서 동일한 사용자 ID 추출 로직이 반복되고 있습니다. AOP나 베이스 컨트롤러를 활용하여 중복을 제거하는 것을 고려해보세요.
AOP를 활용한 예시:
🤖 Prompt for AI Agents