-
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
Changes from 4 commits
fa49270
3b8e244
421c9d2
a3747eb
36962be
22afa77
08dfb81
a93fb89
45e1040
01dab61
5a7bb8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| 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.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 { | ||
|
|
||
| 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); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,4 +10,5 @@ public interface EstatePriceMongoRepository extends MongoRepository<EstatePriceD | |
|
|
||
| List<EstatePriceDocument> findALlByKaptCodeAndExclusiveArea(String kaptCode, double exclusiveArea); | ||
|
|
||
| List<EstatePriceDocument> findByKaptCodeIn(List<String> kaptCodes); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chain대용량 리스트 처리시 성능을 고려해주세요.
다음 사항들을 검토해주세요:
대용량 배치 조회의 성능을 검증하기 위해 다음 스크립트를 실행해보세요: 🏁 Script executed: #!/bin/bash
# MongoDB에서 kaptCode 필드의 인덱스 확인
rg -A 5 -B 5 "kaptCode.*index" --type javaLength of output: 44 인덱스 설정 여부를 재확인하기 위해 아래 스크립트를 실행해주세요: 🏁 Script executed: #!/bin/bash
# EstatePriceDocument 클래스 전체 내용 확인
rg "class EstatePriceDocument" -A50 --type java
# kaptCode 필드에 @Indexed 어노테이션이 붙었는지 확인
rg "@Indexed.*kaptCode" -A3 --type java
# 복합 인덱스(@CompoundIndex) 설정 여부 확인
rg "@CompoundIndex" -A5 --type javaLength of output: 6066 kaptCode 필드에 인덱스 설정 및 대용량 조회 처리 방안 마련 필요
다음 사항을 반드시 검토 및 반영해주세요:
🤖 Prompt for AI Agents |
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,43 @@ | ||
| package com.zipte.platform.server.application.in.dashboard; | ||
|
|
||
| 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 java.util.List; | ||
|
|
||
| public interface DashBoardUseCase { | ||
|
|
||
| /* | ||
| 매매 / 관심 지역 관심 지역 - 실거래가 동향 관심 지역으로 설정한 지역의 가격 변화에 대한 알림을 받는다. | ||
| 매매 / 관심 아파트 관심 아파트 - 시세 변화 관심 아파트의 가격 변화에 대한 알림을 받는다. | ||
| 전체 / 맞춤형 아파트 제공 맞춤형 추천 매물 현황 추천시스템을 통해 관심 아파트로 설정한 유사 아파트를 제공한다. | ||
| 나의 아파트 가격 변화 / 나의 아파트 가격 변화 조회 / 개인정보에 등록한 나의 아파트의 가격 변화를 그래프로 확인한다. | ||
| */ | ||
|
|
||
|
|
||
| /// 관심 지역 조회하기 | ||
| List<Region> getFavoriteRegion(Long userId); | ||
|
|
||
| /// 관심 지역 가격 조회하기 | ||
| List<RegionPrice> getFavoriteRegionPrices(Long userId); | ||
|
|
||
|
|
||
| /// 관심 아파트 목록 조회하기 | ||
| List<Estate> getFavoriteEstates(Long userId); | ||
|
|
||
|
|
||
| /// 관심 아파트 가격 목록 조회하기 | ||
| List<EstatePrice> getFavoriteEstatePrice(Long userId); | ||
|
|
||
|
|
||
| /// AI 추천 목록 조회하기 | ||
|
|
||
|
|
||
| /// 주거지 인증을 한 나의 아파트 조회하기 | ||
| List<EstatePrice> getMyEstatePrices(Long userId); | ||
|
|
||
|
|
||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,5 +15,6 @@ public interface EstatePricePort { | |||||||||
| /// 기간별 조회하기 | ||||||||||
| List<EstatePrice> loadAllEstatePricesBetween(String kaptCode, String from, String to); | ||||||||||
|
|
||||||||||
|
|
||||||||||
| /// 외부 의존성 | ||||||||||
| List<EstatePrice> loadEstatePricesByCodes(List<String> kaptCodes); | ||||||||||
|
Comment on lines
+22
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 주석을 더 명확하게 수정해주세요. "외부 의존성"이라는 주석이 메서드의 목적을 명확히 설명하지 못합니다. 다중 코드를 이용한 배치 조회라는 목적을 반영하여 주석을 개선해주세요. - /// 외부 의존성
+ /// 다중 코드 기반 배치 조회하기
List<EstatePrice> loadEstatePricesByCodes(List<String> kaptCodes);또한 메서드 문서화에서 다음 사항들을 명시하는 것을 고려해보세요:
📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| } | ||||||||||
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