feat : 장소별 곡 좋아요 등록 API 연동 - #129
6 commits merged into
Conversation
📝 WalkthroughWalkthrough장소별 트랙과 좋아요 트랙 API가 추가되고, 관련 응답 타입과 React Query 훅이 구현되었습니다. 핀 목록·카드·찜한 노래 화면은 실제 트랙 데이터를 사용하며, 정렬 값은 대문자 리터럴로 통일되었습니다. Changes트랙 계약 및 API·쿼리 계층
장소별 트랙 시트 연결
좋아요 등록 및 찜한 노래 화면
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant PinListSheet
participant usePlaceTrack
participant getPlaceTracks
participant TrackAPI
PinListSheet->>usePlaceTrack: 장소 좌표·정렬 조건 전달
usePlaceTrack->>getPlaceTracks: 트랙 목록 조회
getPlaceTracks->>TrackAPI: GET 장소별 트랙 요청
TrackAPI-->>PinListSheet: 트랙 목록 반환
sequenceDiagram
participant PinCard
participant usePutLikedTrack
participant putLikedTracks
participant TrackAPI
PinCard->>usePutLikedTrack: placeTrackId 전달
usePutLikedTrack->>putLikedTracks: 좋아요 등록 실행
putLikedTracks->>TrackAPI: PUT 좋아요 요청
TrackAPI-->>usePutLikedTrack: 등록 결과 반환
usePutLikedTrack-->>PinCard: 관련 쿼리 무효화
Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/api/track.ts`:
- Around line 31-45: 장소별 트랙 조회가 선택된 장소와 좌표를 사용하도록 전체 호출 흐름을 수정하세요.
src/api/track.ts의 getPlaceTracks에 placeId를 추가하고 요청 경로를 해당 식별자로 구성하세요.
src/features/pin/queries/usePlaceTrack.ts의 훅 입력과 queryKey에 placeId·위도·경도를 포함하세요.
src/features/pin/components/PinListSheet.tsx에서는 선택된 place의 식별자와 좌표를
usePlaceTrack에 전달하세요.
In `@src/features/pin/components/PinListSheet.tsx`:
- Around line 122-131: Update the usePlaceTrack state handling in PinListSheet
so missing data is not treated as an empty pin list. Use isPending to render the
loading state and isError to render a retryable error state, while preserving
the empty-list message only for successful responses with no tracks; keep the
existing pins mapping for loaded data.
In `@src/pages/MyPlimapPage.tsx`:
- Around line 64-70: Update the track-list rendering in MyPlimapPage so the
loading and error states from useLikeTrack are handled before the tracks.length
=== 0 empty-state check. Only render “아직 찜한 노래가 없어요” after the request succeeds
and the returned tracks collection is genuinely empty.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 148a506e-8de0-4395-959a-27fee056958d
📒 Files selected for processing (12)
src/api/track.tssrc/features/pin/components/PinCard.tsxsrc/features/pin/components/PinListSheet.tsxsrc/features/pin/components/SortTabs.tsxsrc/features/pin/data/mockPinSearchPlaces.tssrc/features/pin/queries/useLikeTrack.tssrc/features/pin/queries/usePlaceTrack.tssrc/features/pin/queries/usePutLikedTrack.tssrc/features/pin/types.tssrc/pages/MapPage.tsxsrc/pages/MyPlimapPage.tsxsrc/pages/PinDetailPage.tsx
💤 Files with no reviewable changes (1)
- src/pages/MapPage.tsx
변경 내용
장소별 곡 좋아요 등록 API(
PUT /api/v1/place-tracks/{placeTrackId}/likes)를 연동하고, PinCard 하트 클릭 시 좋아요가 등록되도록 변경했습니다.putLikedTracksAPI 함수 추가usePutLikedTrackmutation 훅 추가 (성공 시 likeTrack / placeTrack 쿼리 invalidate)PinCard하트 클릭 시 좋아요 등록 연동관련 이슈
Closes #128
변경 사항
테스트
스크린샷 (UI 변경시)
체크리스트
pnpm format)pnpm lint:fix)코드 품질 확인
PR 제출 전에 다음 명령어를 실행하여 코드 품질을 확인해주세요:
Summary by CodeRabbit
새로운 기능
개선