-
Notifications
You must be signed in to change notification settings - Fork 1
[FEAT/REFACTOR] 강사 대시보드 API 연동 및 코드 구조 개선 #39
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
11 commits
Select commit
Hold shift + click to select a range
ad6659b
#37 [CHORE] 외부 구글폼 링크 연결
waldls b92677b
#37 [FEAT] 유저 프로필 이미지 및 이름 쿠키 기반으로 표시
waldls 8c1fb82
#37 [MOD] 헤더 로고 클릭 시 역할별 홈으로 이동
waldls 400f2b6
#37 [FEAT] 새 외주 작성 플랜 조회 API 연동
waldls 496e327
#37 [MOD] 강사 대시보드 데이터 없을 때 처리
waldls ba2b27c
#37 [CHORE] 데이터 없을 때 멘트 수정
waldls c757da9
#37 [FEAT] 수정 중인 외주 API 연동
waldls e168e89
#37 [FEAT] 시안 제출 현황 및 매칭 중인 외주 API 연동
waldls aad1928
#37 [REFACTOR] API 파일 도메인별 통합 및 타입 파일 분리
waldls 1be878a
#37 [FIX] 에러 해결
waldls 4344f5f
#37 [CHORE] API 함수명 맨 앞에 메소드 추가
waldls 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
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
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 |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| export { logout } from "./api/logout"; | ||
| export { postLogout } from "./api/auth"; | ||
| export { useLogout } from "./model/useLogout"; | ||
| export { default as LogoutSidebarMenu } from "./ui/LogoutSidebarMenu"; |
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 |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| export type { CommissionWithDrafts, Draft, DraftDetail } from "./model/choose"; | ||
| export { commissionDraftsData, draftDetailsData } from "./model/choose"; | ||
| export type { CommissionWithDrafts, Draft, DraftDetail } from "./model/chooseMock"; | ||
| export { commissionDraftsData, draftDetailsData } from "./model/chooseMock"; | ||
| export { default as DraftCard } from "./ui/DraftCard"; |
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,37 @@ | ||
| import type { | ||
| DraftSubmissionItem, | ||
| GetDraftSubmissionsResult, | ||
| GetMatchingCommissionsResult, | ||
| GetRevisionsResult, | ||
| MatchingItem, | ||
| ModifyingItem, | ||
| } from "@/features/instructor/home/api/homeTypes"; | ||
| import { api, createApiPath } from "@/shared/api/client"; | ||
| import type { ApiResponse } from "@/shared/api/commonType"; | ||
|
|
||
| // 시안 제출 현황 조회 | ||
| export const getDraftSubmissions = async (): Promise<DraftSubmissionItem[]> => { | ||
| const response = await api | ||
| .get(createApiPath("/api/v1/instructors/dashboards/draft-submissions")) | ||
| .json<ApiResponse<GetDraftSubmissionsResult>>(); | ||
|
|
||
| return response.result?.commissions ?? []; | ||
| }; | ||
|
|
||
| // 매칭 중인 외주 조회 | ||
| export const getMatchingCommissions = async (): Promise<MatchingItem[]> => { | ||
| const response = await api | ||
| .get(createApiPath("/api/v1/instructors/dashboards/matchings")) | ||
| .json<ApiResponse<GetMatchingCommissionsResult>>(); | ||
|
|
||
| return response.result?.commissions ?? []; | ||
| }; | ||
|
|
||
| // 수정 중인 외주 조회 | ||
| export const getRevisions = async (): Promise<ModifyingItem[]> => { | ||
| const response = await api | ||
| .get(createApiPath("/api/v1/instructors/dashboards/revisions")) | ||
| .json<ApiResponse<GetRevisionsResult>>(); | ||
|
|
||
| return response.result?.commissions ?? []; | ||
| }; | ||
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,45 @@ | ||
| export type DraftSubmissionItem = { | ||
| commissionId: number; | ||
| title: string; | ||
| category: string; | ||
| draftSubmission: { | ||
| submitted: number; | ||
| total: number; | ||
| }; | ||
| isViewable: boolean; | ||
| firstDraftDeadline: string; | ||
| }; | ||
|
|
||
| export type MatchingItem = { | ||
| commissionId: number; | ||
| title: string; | ||
| applicationDeadline: string; | ||
| matching: { | ||
| matched: number; | ||
| total: number; | ||
| }; | ||
| }; | ||
|
|
||
| export type ModifyingItem = { | ||
| commissionId: number; | ||
| title: string; | ||
| isSubmitted: boolean; | ||
| hasUpdated: boolean; | ||
| finalDeadline: string; | ||
| }; | ||
|
|
||
| export const CATEGORY_DISPLAY_MAP: Record<string, string> = { | ||
| FLYER_TEXTBOOK_COVER_INNER: "교재 외지/내지", | ||
| }; | ||
|
|
||
| export type GetDraftSubmissionsResult = { | ||
| commissions: DraftSubmissionItem[]; | ||
| }; | ||
|
|
||
| export type GetMatchingCommissionsResult = { | ||
| commissions: MatchingItem[]; | ||
| }; | ||
|
|
||
| export type GetRevisionsResult = { | ||
| commissions: ModifyingItem[]; | ||
| }; |
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 was deleted.
Oops, something went wrong.
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Handle
success: falseexplicitly instead of returning empty lists.Line 18, Line 27, and Line 36 currently collapse API failure payloads into
[], so real backend errors become indistinguishable from “no data”.Suggested fix
export const getDraftSubmissions = async (): Promise<DraftSubmissionItem[]> => { const response = await api .get(createApiPath("/api/v1/instructors/dashboards/draft-submissions")) .json<ApiResponse<GetDraftSubmissionsResult>>(); + if (!response.success) { + throw new Error(response.message); + } return response.result?.commissions ?? []; }; export const getMatchingCommissions = async (): Promise<MatchingItem[]> => { const response = await api .get(createApiPath("/api/v1/instructors/dashboards/matchings")) .json<ApiResponse<GetMatchingCommissionsResult>>(); + if (!response.success) { + throw new Error(response.message); + } return response.result?.commissions ?? []; }; export const getRevisions = async (): Promise<ModifyingItem[]> => { const response = await api .get(createApiPath("/api/v1/instructors/dashboards/revisions")) .json<ApiResponse<GetRevisionsResult>>(); + if (!response.success) { + throw new Error(response.message); + } return response.result?.commissions ?? []; };🤖 Prompt for AI Agents