[hotfix] 특정 유저 공개 피드 조회 화면 상단 api 수정#145
Conversation
|
Caution Review failedThe pull request is closed. Walkthrough특정 유저의 공개 피드 목록 상단 정보 조회 API가 수정되어, 응답에 요청자(로그인 유저)가 해당 피드 소유자를 팔로우하고 있는지 여부( Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant FeedQueryController
participant FeedShowUserInfoService
participant FollowingQueryPersistenceAdapter
participant FeedQueryMapper
Client->>FeedQueryController: GET /feeds/users/{userId}/info (with userId)
FeedQueryController->>FeedShowUserInfoService: showAnotherUserInfoInFeeds(userId, feedOwnerId)
FeedShowUserInfoService->>FollowingQueryPersistenceAdapter: isFollowingUser(userId, feedOwnerId)
FollowingQueryPersistenceAdapter-->>FeedShowUserInfoService: boolean isFollowing
FeedShowUserInfoService->>FeedQueryMapper: toFeedShowUserInfoResponse(feedOwner, feedCount, isFollowing, ...)
FeedQueryMapper-->>FeedShowUserInfoService: FeedShowUserInfoResponse
FeedShowUserInfoService-->>FeedQueryController: FeedShowUserInfoResponse
FeedQueryController-->>Client: BaseResponse<FeedShowUserInfoResponse>
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~18 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes(해당 사항 없음) Possibly related PRs
Suggested labels
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/main/java/konkuk/thip/user/adapter/out/persistence/repository/following/FollowingJpaRepository.java (1)
10-10: 메서드명 길이 개선을 고려해보세요.JPA Query Method 컨벤션을 잘 따르고 있고
exists를 사용한 것도 성능상 적절하지만, 메서드명이 상당히 길어서 가독성이 떨어집니다.커스텀 쿼리를 사용하여 더 간결한 메서드명으로 개선할 수 있습니다:
-boolean existsByUserJpaEntity_UserIdAndFollowingUserJpaEntity_UserId(Long userId, Long followingUserId); +@Query("SELECT COUNT(f) > 0 FROM FollowingJpaEntity f WHERE f.userJpaEntity.userId = :userId AND f.followingUserJpaEntity.userId = :followingUserId") +boolean existsFollowingRelation(@Param("userId") Long userId, @Param("followingUserId") Long followingUserId);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
src/main/java/konkuk/thip/feed/adapter/in/web/FeedQueryController.java(1 hunks)src/main/java/konkuk/thip/feed/adapter/in/web/response/FeedShowUserInfoResponse.java(1 hunks)src/main/java/konkuk/thip/feed/application/mapper/FeedQueryMapper.java(1 hunks)src/main/java/konkuk/thip/feed/application/port/in/FeedShowUserInfoUseCase.java(1 hunks)src/main/java/konkuk/thip/feed/application/service/FeedShowUserInfoService.java(1 hunks)src/main/java/konkuk/thip/user/adapter/out/persistence/FollowingQueryPersistenceAdapter.java(1 hunks)src/main/java/konkuk/thip/user/adapter/out/persistence/repository/following/FollowingJpaRepository.java(1 hunks)src/main/java/konkuk/thip/user/application/port/out/FollowingQueryPort.java(1 hunks)src/test/java/konkuk/thip/feed/adapter/in/web/FeedShowUserInfoApiTest.java(3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#113
File: src/main/java/konkuk/thip/recentSearch/adapter/out/persistence/RecentSearchCommandPersistenceAdapter.java:38-44
Timestamp: 2025-07-30T14:05:04.945Z
Learning: seongjunnoh는 코드 최적화 제안에 대해 구체적인 기술적 근거와 효율성 차이를 이해하고 싶어하며, 성능 개선 방식에 대한 상세한 설명을 선호한다.
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#93
File: src/main/java/konkuk/thip/room/adapter/out/persistence/RoomQueryPersistenceAdapter.java:49-114
Timestamp: 2025-07-28T16:44:31.224Z
Learning: seongjunnoh는 코드 중복 문제에 대한 리팩토링 제안을 적극적으로 수용하고 함수형 인터페이스를 활용한 해결책을 선호한다.
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#112
File: src/main/java/konkuk/thip/feed/adapter/out/persistence/repository/FeedQueryRepositoryImpl.java:272-272
Timestamp: 2025-07-30T10:44:34.115Z
Learning: seongjunnoh는 피드 커서 페이지네이션에서 LocalDateTime 단일 커서 방식을 선호하며, 복합 키 기반 커서보다 구현 단순성과 성능을 우선시한다.
📚 Learning: thip 프로젝트에서는 cqrs port 분리 시 다음 컨벤션을 따름: commandport에는 findbyxxx를 통해 도메인 엔티티를 찾아오는 메서드를 추가하고, querypo...
Learnt from: seongjunnoh
PR: THIP-TextHip/THIP-Server#43
File: src/main/java/konkuk/thip/book/application/port/out/BookCommandPort.java:0-0
Timestamp: 2025-07-03T03:05:05.031Z
Learning: THIP 프로젝트에서는 CQRS Port 분리 시 다음 컨벤션을 따름: CommandPort에는 findByXXX를 통해 도메인 엔티티를 찾아오는 메서드를 추가하고, QueryPort에는 조회 API의 response에 해당하는 데이터들을 DB로부터 조회하는 메서드를 추가함.
Applied to files:
src/main/java/konkuk/thip/user/application/port/out/FollowingQueryPort.java
🧬 Code Graph Analysis (1)
src/test/java/konkuk/thip/feed/adapter/in/web/FeedShowUserInfoApiTest.java (1)
src/test/java/konkuk/thip/common/util/TestEntityFactory.java (1)
TestEntityFactory(33-316)
🔇 Additional comments (13)
src/main/java/konkuk/thip/user/application/port/out/FollowingQueryPort.java (1)
14-14: LGTM! 메서드 설계가 적절합니다.메서드명과 파라미터가 직관적이고, QueryPort의 책임에 맞게 잘 설계되었습니다.
src/main/java/konkuk/thip/user/adapter/out/persistence/FollowingQueryPersistenceAdapter.java (1)
49-52: LGTM! 효율적인 구현입니다.
exists쿼리를 사용하여 데이터 존재 여부만 확인하는 것이 성능상 적절하고, JPA 네이밍 컨벤션도 잘 따르고 있습니다.src/main/java/konkuk/thip/feed/adapter/in/web/response/FeedShowUserInfoResponse.java (1)
8-18: FeedShowUserInfoResponse 필드 순서 변경 호환성 확인 완료ast-grep와 ripgrep 검증 결과,
new FeedShowUserInfoResponse(...)직접 호출FeedShowUserInfoResponse.(빌더 메서드 제외) 정적 메서드 호출어느 곳에서도 사용되고 있지 않음을 확인했습니다.
따라서 필드 순서 변경으로 인한 컴파일 오류나 호환성 문제는 없습니다.src/main/java/konkuk/thip/feed/application/port/in/FeedShowUserInfoUseCase.java (1)
9-9: 구현체와 호출부 모두 새로운 시그니처로 정상 적용됨 확인모든 구현체(
FeedShowUserInfoService)와 호출부(FeedQueryController)가showAnotherUserInfoInFeeds(Long userId, Long feedOwnerId)시그니처로 올바르게 업데이트된 것을 확인했습니다. 더 이상 추가 수정이 필요하지 않습니다.src/main/java/konkuk/thip/feed/adapter/in/web/FeedQueryController.java (2)
80-80: API 문서 업데이트가 적절합니다.새로운 기능인 팔로잉 상태 조회가 description에 명확히 반영되었습니다.
84-87: 메서드 시그니처 변경이 올바르게 구현되었습니다.인증된 사용자 ID(
userId)와 피드 소유자 ID(feedOwnerId) 파라미터를 모두 받아 팔로잉 상태를 확인할 수 있도록 적절히 수정되었습니다. 파라미터 설명도 명확합니다.src/main/java/konkuk/thip/feed/application/mapper/FeedQueryMapper.java (1)
55-64: 매퍼 메서드 업데이트가 적절합니다.새로운 필드인
creatorId와isFollowing매핑이 올바르게 추가되었고, 메서드 시그니처도 새로운 파라미터를 반영하여 적절히 수정되었습니다.src/main/java/konkuk/thip/feed/application/service/FeedShowUserInfoService.java (2)
38-38: 자신의 정보 조회시 isFollowing 처리가 올바릅니다.사용자가 자신을 팔로우할 수 없으므로
false로 설정하는 것이 논리적으로 적절합니다.
43-57: 다른 사용자 정보 조회 로직이 잘 구현되었습니다.메서드 시그니처가 적절히 수정되었고, 팔로잉 상태 확인 로직이 올바르게 추가되었습니다. 포트 인터페이스를 통한 팔로잉 상태 조회는 클린 아키텍처 원칙을 잘 따르고 있습니다.
src/test/java/konkuk/thip/feed/adapter/in/web/FeedShowUserInfoApiTest.java (4)
170-170: 기존 테스트에 인증 컨텍스트 추가가 적절합니다.API 변경사항에 맞춰 인증된 사용자 컨텍스트를 추가하여 테스트가 올바르게 수정되었습니다.
Also applies to: 198-199
201-201: 새로운 응답 필드 검증이 잘 추가되었습니다.
creatorId와isFollowing필드에 대한 검증이 적절히 추가되어 새로운 기능이 올바르게 테스트됩니다.Also applies to: 208-208
213-237: 팔로잉 시나리오 테스트가 잘 구현되었습니다.팔로잉 관계가 있는 경우의
isFollowing=true시나리오를 별도 테스트로 분리하여 명확하게 검증하고 있습니다. 테스트 데이터 설정과 검증 로직이 적절합니다.
245-245: 다른 테스트 메서드들의 인증 컨텍스트 업데이트가 일관됩니다.모든 관련 테스트가 새로운 API 요구사항에 맞춰 일관되게 수정되었습니다.
Also applies to: 291-292
#️⃣ 연관된 이슈
📝 작업 내용
@heeeeyong 님의 요청으로 특정 유저의 공개 피드 목록 조회 시, 해당 화면의 상단 부분을 구성하는 api 를 수정하였습니다

(아래 화면을 구성하는 api 입니다)
📸 스크린샷
💬 리뷰 요구사항
📌 PR 진행 시 이러한 점들을 참고해 주세요
Summary by CodeRabbit
신규 기능
버그 수정
테스트
환경설정