Skip to content

[Feature/#220] 플랫폼별 광고 현황 상세 API 연동 - #221

Merged
YermIm merged 2 commits into
developfrom
feature/#220
May 18, 2026
Merged

YermIm merged 2 commits into
developfrom
feature/#220

Conversation

@YermIm

@YermIm YermIm commented May 17, 2026

Copy link
Copy Markdown
Collaborator

🚨 관련 이슈

close #220

✨ 변경사항

  • 🐞 BugFix Something isn't working
  • 💻 CrossBrowsing Browser compatibility
  • 🌏 Deploy Deploy
  • 🎨 Design Markup & styling
  • 📃 Docs Documentation writing and editing (README.md, etc.)
  • ✨ Feature Feature
  • 🔨 Refactor Code refactoring
  • ⚙️ Setting Development environment setup
  • ✅ Test Test related (storybook, jest, etc.)

✏️ 작업 내용

스크린샷 2026-05-17 오후 10 08 46 스크린샷 2026-05-17 오후 10 09 00
  • GET /api/dashboard/{orgId}/metric-facts 연동
  • 기간 선택(최근 7일 / 30일)에 따라 days 파라미터로 재조회
  • mock 데이터 및 관련 타입 제거

😅 미완성 작업

N/A

📢 논의 사항 및 참고 사항

N/A

💬 리뷰어 가이드 (P-Rules)
P1: 필수 반영 (Critical) - 버그 가능성, 컨벤션 위반. 해결 전 머지 불가.
P2: 적극 권장 (Recommended) - 더 나은 대안 제시. 가급적 반영 권장.
P3: 제안 (Suggestion) - 아이디어 공유. 반영 여부는 드라이버 자율.
P4: 단순 확인/칭찬 (Nit) - 사소한 오타, 칭찬 등 피드백.

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능
    • 광고 현황 상세 정보의 일별 조회 기능을 추가했습니다. 지출, 노출, 클릭, CTR, CPC, 전환, ROAS 등의 성과 지표를 날짜별로 확인할 수 있습니다.

Review Change Stack

@YermIm
YermIm requested review from Seojegyeong and jjjsun May 17, 2026 12:53
@YermIm YermIm self-assigned this May 17, 2026
@YermIm YermIm added the 📬 API 서버 API 통신 label May 17, 2026
@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

플랫폼 대시보드의 광고 현황 상세 테이블을 mock 데이터 기반에서 실제 API 기반으로 전환했습니다. 새로운 타입 정의와 메트릭 팩트 API 함수, 데이터 변환 훅을 추가하고, 기존 테이블 컴포넌트를 확장하여 API 응답 합계값을 선택적으로 받도록 수정했습니다.

Changes

플랫폼 대시보드 메트릭 팩트 기능

Layer / File(s) Summary
타입 정의 및 API 계약
src/types/dashboard/platform.ts, src/api/dashboard/platform.ts
IMetricFactsParams, IMetricFactsResponse, IMetricFactsRow, IPlatformDailyPerformance 타입을 정의하여 API 요청/응답 구조와 테이블 UI 데이터 모델을 명시했습니다.
메트릭 팩트 API 함수
src/api/dashboard/platform.ts
/api/dashboard/{orgId}/metric-facts 엔드포인트를 호출하는 getMetricFacts 함수를 추가하여 orgId와 파라미터를 기반으로 일별 지표 데이터를 조회합니다.
데이터 로드 및 변환 훅
src/hooks/dashboard/usePlatformMetricFacts.ts
usePlatformMetricFacts 훅에서 API 조회 후 데이터를 변환합니다. 날짜를 yy.mm.dd(요일) 형식으로 포맷하고, 일자별 데이터를 내림차순 정렬하며, 합계는 고정 문자열 "합계"로 생성합니다.
테이블 컴포넌트 업데이트
src/components/dashboard/platform/PlatformDetailTable.tsx
선택적 total prop을 추가하여 외부에서 전달된 합계값이 있으면 우선하고, 없으면 계산된 값을 사용하는 방식으로 변경했습니다.
뷰 통합 및 데이터 전환
src/components/dashboard/platform/SinglePlatformView.tsx
usePlatformMetricFacts 훅을 호출하여 API 데이터를 로드하고, mock 기반 platformDailyPerformanceMock를 제거합니다. 로딩/에러/빈 데이터 상태에 따라 조건부 렌더링을 구현했습니다.
Mock 파일 정리
src/pages/dashboard/platform/platformDashboard.mock.ts
"실시간 트래픽 데이터 추가" 주석을 추가하여 변경 의도를 문서화했습니다.

Sequence Diagram

sequenceDiagram
  participant SinglePlatformView
  participant usePlatformMetricFacts
  participant getMetricFacts
  participant API as /api/dashboard/{orgId}/metric-facts
  participant PlatformDetailTable
  
  SinglePlatformView->>usePlatformMetricFacts: (provider, viewRange) 호출
  usePlatformMetricFacts->>getMetricFacts: orgId, params 전달
  getMetricFacts->>API: GET 요청
  API-->>getMetricFacts: IMetricFactsResponse 반환
  getMetricFacts-->>usePlatformMetricFacts: 응답 반환
  usePlatformMetricFacts->>usePlatformMetricFacts: 날짜 포맷, 정렬, 매핑
  usePlatformMetricFacts-->>SinglePlatformView: dailyRows + totalRow
  SinglePlatformView->>PlatformDetailTable: data, total 전달
  PlatformDetailTable-->>SinglePlatformView: 테이블 렌더링
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • WhereYouAd/WhereYouAd-Frontend#175: 이전 PR에서 PlatformDetailTableSinglePlatformView UI 기초를 구축했으며, 본 PR은 해당 컴포넌트들을 mock 데이터에서 실제 API 기반으로 확장하는 후속 작업입니다.

Suggested labels

✨ Feature

Suggested reviewers

  • jjjsun
  • Seojegyeong
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive PR 설명이 기본 요구사항을 충족했으나 작업 내용이 스크린샷만으로 제시되어 상세한 설명이 부족합니다. 작업 내용 섹션에 API 연동 상세 내용(엔드포인트, 파라미터, 데이터 변환 로직 등)을 텍스트로 구체적으로 작성해주세요.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 주요 변경사항을 명확하게 요약하고 있으며, 이슈 번호(#220)를 포함하여 구체적입니다.
Linked Issues check ✅ Passed 변경사항들이 이슈 #220의 요구사항을 충족합니다: API 연동 구현, 7일/30일 선택 기능, 일별 메트릭 데이터 제공.
Out of Scope Changes check ✅ Passed 모든 변경사항이 광고 현황 상세 API 연동이라는 명확한 목표에 집중되어 있으며, 범위를 벗어난 변경은 없습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/#220

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 17, 2026

Copy link
Copy Markdown

📚 Storybook 배포 완료

항목 링크
📖 Storybook https://69a147b60a56365d9e2185ef-nefqhfgzve.chromatic.com/
🔍 Chromatic https://www.chromatic.com/build?appId=69a147b60a56365d9e2185ef&number=290

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/hooks/dashboard/usePlatformMetricFacts.ts`:
- Around line 33-34: mapRow() and mapTotalRow() are currently assigning
IMetricFactsRow.cpa into the cpc output field, causing CPA to be shown as CPC;
update these two functions to either (A) map cpc to the actual CPC value by
computing spend / clicks (use safe divide and fallback to 0), or (B) if the API
intent is to expose CPA instead, rename the output field to cpa (and any UI
references) so the contract matches. Locate the mapping in mapRow and
mapTotalRow and replace the line "cpc: row.cpa" with the appropriate fix: "cpc:
row.spend / row.clicks" (with divide-by-zero guard) for computed CPC, or "cpa:
row.cpa" and update downstream UI props if you choose to surface CPA. Ensure
types in IMetricFactsRow and return shape are updated accordingly.
🪄 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

Run ID: ba2cb6b1-db87-4810-ae1c-63723a131ada

📥 Commits

Reviewing files that changed from the base of the PR and between 0dd77f7 and ee0731c.

📒 Files selected for processing (6)
  • src/api/dashboard/platform.ts
  • src/components/dashboard/platform/PlatformDetailTable.tsx
  • src/components/dashboard/platform/SinglePlatformView.tsx
  • src/hooks/dashboard/usePlatformMetricFacts.ts
  • src/pages/dashboard/platform/platformDashboard.mock.ts
  • src/types/dashboard/platform.ts
💤 Files with no reviewable changes (1)
  • src/pages/dashboard/platform/platformDashboard.mock.ts

Comment thread src/hooks/dashboard/usePlatformMetricFacts.ts Outdated
@YermIm YermIm added the ✨ Feature 기능 개발 label May 17, 2026

@Seojegyeong Seojegyeong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

P4: 확인했습니다!

@jjjsun

jjjsun commented May 18, 2026

Copy link
Copy Markdown
Collaborator

P4: 확인했습니다!

@YermIm
YermIm merged commit b18ed87 into develop May 18, 2026
3 checks passed
@YermIm
YermIm deleted the feature/#220 branch May 18, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📬 API 서버 API 통신 ✨ Feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ [Feature] 플랫폼 대시보드 광고 현황 상세 API 연동

3 participants