-
Notifications
You must be signed in to change notification settings - Fork 1
[Feature/#198] 플랫폼 대시보드(전체) 상/하단 지표 API 연동 #204
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8b9dbe5
feat: 성과 우수 플랫폼 순위 API 연동
YermIm b16f68a
feat: 광고 소재 현황 API 연동
YermIm 6f23ef1
feat: 플랫폼별 성과 효율 비교 API 연동
YermIm 5838bd6
fix: 성과 효율 비교 차트 Y축 스케일 통합
YermIm a6b0bb9
feat: 개별 플랫폼 상세 카드 API 연동
YermIm 196e842
Merge branch 'develop' of https://github.com/WhereYouAd/WhereYouAd-Fr…
YermIm f07cabd
fix: usePlatformPerformance 오류 처리
YermIm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import type { ICommonResponse } from "@/types/common/common"; | ||
| import type { IAdCountParams, IAdStatusData } from "@/types/dashboard/platform"; | ||
|
|
||
| import { axiosInstance } from "@/lib/axiosInstance"; | ||
|
|
||
| // 광고 소재 현황 조회 API | ||
| export const getAdCount = async ( | ||
| orgId: number, | ||
| params?: IAdCountParams, | ||
| ): Promise<IAdStatusData> => { | ||
| const { data } = await axiosInstance.get<ICommonResponse<IAdStatusData>>( | ||
| `/api/dashboard/${orgId}/ad-count`, | ||
| { params }, | ||
| ); | ||
| return data.data; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import type { | ||
| IAdStatusData, | ||
| TPlatformProvider, | ||
| } from "@/types/dashboard/platform"; | ||
|
|
||
| import { useCoreQuery } from "@/hooks/customQuery"; | ||
|
|
||
| import { getAdCount } from "@/api/dashboard/platform"; | ||
| import useWorkspaceStore from "@/store/useWorkspaceStore"; | ||
|
|
||
| // TODO: 추후 제거 | ||
| const normalizeProvider = (provider: string): TPlatformProvider => | ||
| provider === "KAKAO" ? "META" : (provider as TPlatformProvider); | ||
|
|
||
| // 광고 소재 현황 | ||
| export function usePlatformAdCount() { | ||
| const orgId = useWorkspaceStore((s) => s.selectedOrgId); | ||
|
|
||
| return useCoreQuery<IAdStatusData>( | ||
| ["platform", "adCount", orgId], | ||
| () => getAdCount(orgId!), | ||
| { | ||
| enabled: !!orgId, | ||
| select: (data): IAdStatusData => ({ | ||
| ...data, | ||
| providerCount: data.providerCount.map((item) => ({ | ||
| ...item, | ||
| provider: normalizeProvider(item.provider), | ||
| })), | ||
| }), | ||
| }, | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import type { TProviderType } from "@/types/dashboard/overview"; | ||
| import type { | ||
| IPlatformPerformance, | ||
| TPlatformProvider, | ||
| } from "@/types/dashboard/platform"; | ||
|
|
||
| import { useCoreQuery } from "@/hooks/customQuery"; | ||
|
|
||
| import { getOverview } from "@/api/dashboard/overview"; | ||
| import useWorkspaceStore from "@/store/useWorkspaceStore"; | ||
|
|
||
| // TODO: 추후 제거 | ||
| const normalizeProvider = (provider: string): TPlatformProvider => | ||
| provider === "KAKAO" ? "META" : (provider as TPlatformProvider); | ||
|
|
||
| const PROVIDERS: TProviderType[] = ["GOOGLE", "NAVER", "KAKAO"]; | ||
|
|
||
| // 플랫폼별 성과 효율 (3개 플랫폼 병렬 조회 후 병합) | ||
| export function usePlatformPerformance() { | ||
| const orgId = useWorkspaceStore((s) => s.selectedOrgId); | ||
|
|
||
| return useCoreQuery( | ||
| ["platform", "performance", orgId], | ||
| async (): Promise<IPlatformPerformance[]> => { | ||
| const settled = await Promise.allSettled( | ||
| PROVIDERS.map((provider) => | ||
| getOverview(orgId!, provider).then((metrics) => ({ | ||
| ...metrics, | ||
| provider: normalizeProvider(provider), | ||
| })), | ||
| ), | ||
| ); | ||
|
|
||
| const success = settled | ||
| .filter( | ||
| (r): r is PromiseFulfilledResult<IPlatformPerformance> => | ||
| r.status === "fulfilled", | ||
| ) | ||
| .map((r) => r.value); | ||
|
|
||
| if (success.length !== PROVIDERS.length) { | ||
| throw new Error("일부 플랫폼 성과 데이터를 불러오지 못했습니다."); | ||
| } | ||
| return success; | ||
| }, | ||
| { enabled: !!orgId }, | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import type { IRoasRanking } from "@/types/dashboard/overview"; | ||
|
|
||
| import { useCoreQuery } from "@/hooks/customQuery"; | ||
|
|
||
| import { getRoasRankings } from "@/api/dashboard/overview"; | ||
| import useWorkspaceStore from "@/store/useWorkspaceStore"; | ||
| // TODO: 추후 제거 | ||
| const normalizeProvider = (provider: string): string => | ||
| provider === "KAKAO" ? "META" : provider; | ||
| // ROAS 성과 순위 (상위 3개) | ||
| export function usePlatformRoasRankings() { | ||
| const orgId = useWorkspaceStore((s) => s.selectedOrgId); | ||
| return useCoreQuery( | ||
| ["platform", "roasRankings", orgId], | ||
| // TODO: 추후 제거 | ||
| () => | ||
| getRoasRankings(orgId!, { | ||
| startDate: "2026-01-22", | ||
| endDate: "2026-03-22", | ||
| }), | ||
|
YermIm marked this conversation as resolved.
|
||
| { | ||
| enabled: !!orgId, | ||
| select: (data): IRoasRanking[] => | ||
| data.rankings.map((item) => ({ | ||
| ...item, | ||
| provider: normalizeProvider(item.provider), | ||
| })), | ||
| }, | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.