Skip to content

travel-detail 가독성 위한 리팩토링#230

Merged
chungjeongsu merged 4 commits into
developfrom
refactor/travel-detail
Apr 27, 2026
Merged

travel-detail 가독성 위한 리팩토링#230
chungjeongsu merged 4 commits into
developfrom
refactor/travel-detail

Conversation

@chungjeongsu

Copy link
Copy Markdown
Contributor

No description provided.

@chungjeongsu chungjeongsu self-assigned this Apr 27, 2026
@chungjeongsu chungjeongsu merged commit b111c8b into develop Apr 27, 2026
1 check passed
@chungjeongsu chungjeongsu deleted the refactor/travel-detail branch April 27, 2026 22:11

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the group detail retrieval logic by consolidating data access from multiple repositories into a centralized custom repository using Querydsl. This change simplifies the GroupUseCase and updates the GroupDetailRes DTO to handle the new data structure. Feedback suggests using explicit joins in Querydsl for better query plan predictability and considering query consolidation techniques, such as Querydsl's Transform, to reduce the number of database round-trips.

.from(travelReviewImage)
.join(travelReviewImage.travelReview, travelReview)
.where(
travelReview.travelItinerary.group.id.eq(groupId),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

암시적 조인(Implicit Join)보다는 명시적 조인(Explicit Join)을 사용하는 것이 쿼리 실행 계획을 예측하기에 더 좋습니다. travelReview.travelItinerary에 대해 명시적 조인을 추가하는 것을 고려해 보세요.

                .join(travelReviewImage.travelReview, travelReview)
                .join(travelReview.travelItinerary, travelItinerary)
                .where(
                        travelItinerary.group.id.eq(groupId),
                        travelReview.isDeleted.isFalse()
                )

Comment on lines +108 to +113
int travelCount = Math.toIntExact(groupJpaRepository.countTravels(groupId));
List<RecentTravelDto> recentTravels = myRole == Role.GUEST
? List.of()
: groupJpaRepository.findRecentTravels(groupId, DETAIL_RECENT_SIZE);
List<RecentReviewDto> recentReviews = groupJpaRepository.findRecentReviews(groupId, DETAIL_RECENT_SIZE);
List<RecentPhotoDto> recentPhotos = groupJpaRepository.findRecentPhotos(groupId, DETAIL_RECENT_SIZE);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

그룹 상세 페이지 조회를 위해 여러 번의 개별 쿼리가 실행되고 있습니다. 현재는 데이터 양이 적어 문제가 되지 않을 수 있으나, 성능 최적화가 필요한 경우 Querydsl의 Transform 등을 활용하여 하나의 쿼리로 프로젝션하거나 필요한 정보를 묶어서 조회하는 방식을 고려해 볼 수 있습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant