-
Notifications
You must be signed in to change notification settings - Fork 3
Feat/111/gathering api #120
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
Conversation
Walkthroughμ΄ ν 리νμ€νΈλ μ¬λ¬ νμΌμμ λΉλκΈ° ν¨μμ API νΈμΆμ μΆκ°νκ±°λ μ κ±°νλ λ΄μ©μ ν¬ν¨νκ³ μμ΅λλ€. Changes
Possibly related PRs
Suggested labels
Suggested reviewers
Warning There were issues while running some tools. Please review the errors and either fix the toolβs configuration or disable the tool if itβs a critical failure. π§ eslint
src/_apis/gathering/gathering-detail-apis.tsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't determine the plugin "react-hooks" uniquely.
Please remove the "plugins" setting from either config or remove either plugin installation. If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
πstorybook: https://67206cc6ff9d7a05a3528ff8-asieuxmabv.chromatic.com/ |
|
πstorybook: https://67206cc6ff9d7a05a3528ff8-lfhuvjbhzv.chromatic.com/ |
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.
Actionable comments posted: 4
π§Ή Outside diff range and nitpick comments (12)
src/_queries/crew/gathering-list-queries.ts (1)
Line range hint
5-11: μλ¬ μ²λ¦¬ κ°μ μ΄ νμν©λλ€.useQuery ν μμ μλ¬ μν©μ λν μ²λ¦¬κ° λ―Έν‘ν©λλ€. μ¬μ©μ κ²½ν ν₯μμ μν΄ μλ¬ μ²λ¦¬λ₯Ό μΆκ°νλ κ²μ΄ μ’κ² μ΅λλ€.
λ€μκ³Ό κ°μ΄ κ°μ ν΄λ³΄μΈμ:
export function useGetGatheringListQuery(id: number) { return useQuery<GatheringType[], Error>({ queryKey: ['gatheringList', id], queryFn: () => getGatheringList(id), enabled: !!id, + retry: 1, + onError: (error) => { + console.error('λͺ¨μ λͺ©λ‘μ λΆλ¬μ€λλ° μ€ν¨νμ΅λλ€:', error); + } }); }src/app/(crew)/crew/detail/[id]/_components/detail-crew-section.tsx (3)
Line range hint
16-16: TODO μ£Όμ μ λ°μ΄νΈκ° νμν©λλ€νμ¬ κ΅¬νλ μλ¬ μ²λ¦¬κ° μ΄λ―Έ μΆ©λΆν κ²¬κ³ ν΄ λ³΄μ λλ€. μ΄ TODO μ£Όμμ΄ μ¬μ ν νμνμ§ κ²ν ν΄ μ£ΌμκΈ° λ°λλλ€.
Line range hint
18-31: μλ¬ λ©μμ§ μμνλ₯Ό μ μλ립λλ€μλ¬ μ²λ¦¬ λ‘μ§μ΄ μ ꡬνλμ΄ μμ΅λλ€. λ€λ§, μλ¬ λ©μμ§λ₯Ό μμλ‘ λΆλ¦¬νλ©΄ μ μ§λ³΄μκ° λμ± μ©μ΄ν΄μ§ κ² κ°μ΅λλ€.
λ€μκ³Ό κ°μ λ°©μμ μ μλ립λλ€:
+const ERROR_MESSAGES = { + NOT_FOUND: 'ν¬λ£¨ μ 보λ₯Ό μ°Ύμ μ μμ΅λλ€', + DEFAULT: 'λ°μ΄ν° ν΅μ μ μ€ν¨νμ΅λλ€.', +}; if (error) { if (error instanceof ApiError) { try { const errorData = JSON.parse(error.message); if (errorData.status === 'NOT_FOUND') { - return <p>ν¬λ£¨ μ 보λ₯Ό μ°Ύμ μ μμ΅λλ€</p>; + return <p>{ERROR_MESSAGES.NOT_FOUND}</p>; } } catch { return <p>{`Error ${error.status}: ${error.message}`}</p>; } } - return <p>λ°μ΄ν° ν΅μ μ μ€ν¨νμ΅λλ€.</p>; + return <p>{ERROR_MESSAGES.DEFAULT}</p>; }
Line range hint
34-34: λ‘λ© μν κ°μ μ μ μλ립λλ€νμ¬ κ΅¬νμ μ λμ΄μμ§λ§, μ¬μ©μ κ²½ν ν₯μμ μν΄ λ‘λ© μνμ μ€μΌλ ν€ UIλ λ μΈλ ¨λ λ‘λ© μ»΄ν¬λνΈλ₯Ό μ μ©νλ κ²μ κ³ λ €ν΄λ³΄μλ©΄ μ’μ κ² κ°μ΅λλ€.
src/app/(crew)/crew/detail/[id]/page.tsx (1)
Line range hint
29-29: μ£Όμ μ²λ¦¬λ μ»΄ν¬λνΈ λ° TODO νλͺ© μ²λ¦¬κ° νμν©λλ€.
CreateGatheringμ»΄ν¬λνΈμ 리뷰 μΉμ μ΄ μ£Όμ μ²λ¦¬λμ΄ μμ΅λλ€. μ΄λ¬ν μ£Όμ μ²λ¦¬λ μ½λμ TODO νλͺ©μ λν ν₯ν κ³νμ΄λ ꡬν μΌμ μ λͺ νν ν΄μ£ΌμκΈ° λ°λλλ€.μ΄ κΈ°λ₯λ€μ ꡬνμ μν μ΄μλ₯Ό μμ±ν΄λ릴κΉμ? λλ ꡬνμ λμμ΄ νμνμ κ°μ?
Also applies to: 35-41
src/app/(crew)/crew/_components/gathering-detail-modal/container.tsx (1)
26-28: Toast μ νΈλ¦¬ν° ν¨μμ μ¬μ¬μ©μ± κ°μ μ μ μλ립λλ€.νμ¬ μ»΄ν¬λνΈ λ΄λΆμ μ μλ
showToastν¨μλ₯Ό λ³λμ μ νΈλ¦¬ν°λ‘ λΆλ¦¬νλ©΄ μ¬μ¬μ©μ±μ΄ ν₯μλ κ² κ°μ΅λλ€.λ€μκ³Ό κ°μ 리ν©ν λ§μ μ μλ립λλ€:
- const showToast = (message: string, type: 'success' | 'error' | 'warning') => { - Toast({ message, type }); - };μλ‘μ΄ μ νΈλ¦¬ν° νμΌ
src/utils/toast.ts:export const showToast = (message: string, type: 'success' | 'error' | 'warning') => { Toast({ message, type }); };src/components/common/gathering-card/scheduled-gathering-card/container.tsx (3)
Line range hint
19-20: API ν΅ν© μμ μλ£ νμνμ¬ λ€μκ³Ό κ°μ ꡬνμ΄ λλ½λμ΄ μμ΅λλ€:
- λͺ¨μ μμΈ μ 보 μ‘°ν API μ°λ
- μ’μμ ν κΈ κΈ°λ₯ ꡬν
- λ°μ΄ν° 리νμΉ λ‘μ§
PR μ€λͺ μ λ°λ₯΄λ©΄ λ‘κ·ΈμΈ ν ν° λ¬Έμ λ‘ API ν μ€νΈκ° μμ ν μ΄λ£¨μ΄μ§μ§ μμλ€κ³ ν©λλ€. μ΄ λ¬Έμ κ° ν΄κ²°λ ν API ν΅ν©μ μλ£ν΄μ£ΌμΈμ.
API ν΅ν© μμ μ λμμ΄ νμνμλ€λ©΄ λ§μν΄ μ£ΌμΈμ.
Also applies to: 66-69, 71-73
Line range hint
16-95: μ»΄ν¬λνΈ κ°μ μ μνμ¬ κ΅¬μ‘°μ λ€μ μ¬νλ€μ μΆκ°νλ©΄ μ’μ κ² κ°μ΅λλ€:
- API νΈμΆ μ λ‘λ© μν κ΄λ¦¬
- μλ¬ μ²λ¦¬ λ‘μ§ μΆκ°
- API μλ΅ νμ μ μ (
GatheringDetailTypeμΈν°νμ΄μ€ μΆκ°)λ€μκ³Ό κ°μ΄ κ°μ ν μ μμ΅λλ€:
interface GatheringDetailType { crewId: number; id: number; title: string; // ... κΈ°ν νμν νλ } // λ‘λ© λ° μλ¬ μν κ΄λ¦¬ μμ const { data: modalData, isLoading, error } = useQuery<GatheringDetailType>(...); // μ»΄ν¬λνΈ λ΄λΆ if (isLoading) return <LoadingSpinner />; if (error) return <ErrorMessage />;
λλ―Έ λ°μ΄ν° μ¬μ© νμΈ μλ£
src/components/common/gathering-card/scheduled-gathering-card/container.tsxνμΌ λ΄μμdummyModalDataκ° μ¬μ©λκ³ μμ΅λλ€. μ€μ API ꡬν μ ν΄λΉ λλ―Έ λ°μ΄ν°λ₯Ό μ κ±°νκ³ API λ°μ΄ν°λ₯Ό μ°λν΄μΌ ν©λλ€.
dummyModalDataμ¬μ© μμΉ:
- λΌμΈ 27:
const dummyModalData = {- λΌμΈ 29:
{dummyModalData && (- λΌμΈ 31:
data={dummyModalData}π Analysis chain
Line range hint
27-65: λλ―Έ λ°μ΄ν°λ₯Ό μ€μ API ꡬνμΌλ‘ κ΅μ²΄ νμλλ―Έ λ°μ΄ν°κ° API μλ΅ νμκ³Ό μΌμΉνμ§λ§, νλ‘λμ μ½λμμ νλμ½λ©λ λ°μ΄ν°λ₯Ό μ¬μ©νλ κ²μ λ°λμ§νμ§ μμ΅λλ€. API ν΅ν©μ΄ μλ£λλ©΄ μ΄ λΆλΆμ μ κ±°ν΄μΌ ν©λλ€.
λ€μ μ€ν¬λ¦½νΈλ₯Ό μ€ννμ¬ λ€λ₯Έ μ»΄ν¬λνΈμμλ λΉμ·ν λλ―Έ λ°μ΄ν°κ° μ¬μ©λκ³ μλμ§ νμΈνκ² μ΅λλ€:
λλ―Έ λ°μ΄ν° μ¬μ© μ¬λΆ μΆκ° νμΈμ μν μ€ν¬λ¦½νΈ μ€ν νμ
μ΄μ μ€ν¬λ¦½νΈμμ 'tsx' νμΌ μ νμ μΈμνμ§ λͺ»νμ΅λλ€. λ€μ μ€ν¬λ¦½νΈλ₯Ό μ€ννμ¬ 'dummyModalData' λλ 'dummy'κ° μ¬μ©λ μμΉλ₯Ό νμΈν΄μ£ΌμΈμ.
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # λλ―Έ λ°μ΄ν° μ¬μ© μ¬λΆ νμΈ rg -t tsx "dummyModalData|dummy" src/Length of output: 67
Script:
#!/bin/bash # λλ―Έ λ°μ΄ν° μ¬μ© μ¬λΆ νμΈμ μν μμ λ μ€ν¬λ¦½νΈ rg "dummyModalData|dummy" --glob "*.tsx" src/Length of output: 361
src/components/common/gathering-card/container.tsx (1)
Line range hint
52-65: μλ¬ μ²λ¦¬ λ‘μ§ κ°μ μ μ μλ립λλ€.νμ¬ μλ¬ μ²λ¦¬ ꡬνμ΄ μ λμ΄μμ§λ§, λ€μκ³Ό κ°μ κ°μ μ¬νμ κ³ λ €ν΄λ³΄μλ©΄ μ’μ κ² κ°μ΅λλ€:
- μλ¬ λ©μμ§λ₯Ό λ ꡬ체μ μΌλ‘ μ 곡
- μΌμμ μΈ λ€νΈμν¬ μ€λ₯μ λν μ¬μλ λ‘μ§ μΆκ°
λ€μκ³Ό κ°μ΄ κ°μ ν΄λ³΄μλ 건 μ΄λ¨κΉμ?:
useEffect(() => { if (error) { if (error instanceof ApiError) { try { const errorData = JSON.parse(error.message); if (errorData.status === 'NOT_FOUND') { - Toast({ message: 'λͺ¨μ μ 보λ₯Ό μ°Ύμ μ μμ΅λλ€.', type: 'error' }); + Toast({ + message: `λͺ¨μ ID ${id}μ λν μ 보λ₯Ό μ°Ύμ μ μμ΅λλ€. μμ λμκ±°λ μ κ·Ό κΆνμ΄ μμ μ μμ΅λλ€.`, + type: 'error' + }); } } catch { - Toast({ message: `Error ${error.status}: ${error.message}`, type: 'error' }); + Toast({ + message: `μλ² μ€λ₯κ° λ°μνμ΅λλ€ (${error.status}). μ μ ν λ€μ μλν΄μ£ΌμΈμ.`, + type: 'error' + }); } } else { - Toast({ message: 'λ°μ΄ν° ν΅μ μ μ€ν¨νμ΅λλ€.', type: 'error' }); + Toast({ + message: 'λ€νΈμν¬ μ°κ²°μ νμΈν΄μ£ΌμΈμ. λ¬Έμ κ° μ§μλλ©΄ μλ‘κ³ μΉ¨μ ν΄μ£ΌμΈμ.', + type: 'error' + }); } } }, [error, id]);src/app/(crew)/crew/_components/gathering-detail-modal/gathering-detail-modal.stories.tsx (2)
58-58: λͺ¨λ μ€ν 리μμ λμΌν crewId κ° μ¬μ©μ λν κ²ν νμλͺ¨λ μ€ν 리μμ
crewId: 1λ‘ λμΌν κ°μ μ¬μ©νκ³ μμ΅λλ€. λ€μν μλ리μ€λ₯Ό ν μ€νΈνκΈ° μν΄μλ κ°κΈ° λ€λ₯ΈcrewIdκ°μΌλ‘ μ€ν 리λ₯Ό μΆκ°νλ κ²μ΄ μ’μ κ² κ°μ΅λλ€.λ€μκ³Ό κ°μ΄ κ° μ€ν 리λ³λ‘ λ€λ₯Έ
crewIdκ°μ μ¬μ©νλ κ²μ μ μλ립λλ€:// ModalWithUser - crewId: 1, + crewId: 101, // ModalWithCaptain - crewId: 1, + crewId: 102, // ModalWithCrew - crewId: 1, + crewId: 103,Also applies to: 101-101, 144-144
Line range hint
58-90: ν μ€νΈ λ°μ΄ν°μ μ΄λ©μΌ μ€λ³΅ μμ νμκ° μ€ν 리μ μ°Έκ°μ λ°μ΄ν°μμ λͺ¨λ μ΄λ©μΌμ΄ '[email protected]'λ‘ λμΌνκ² μ€μ λμ΄ μμ΅λλ€. μ€μ μ¬μ© μ¬λ‘λ₯Ό λ μ λ°μνκ³ ν μ€νΈμ μ λ’°μ±μ λμ΄κΈ° μν΄ κ°κΈ° λ€λ₯Έ μ΄λ©μΌμ μ¬μ©νλ κ²μ΄ μ’κ² μ΅λλ€.
κ° μ°Έκ°μλ³λ‘ κ³ μ ν μ΄λ©μΌμ μ¬μ©νλλ‘ μμ μ μ μλ립λλ€:
participants: [ { id: 1, profileImageUrl: '...', nickname: 'λ½μμ¦μ¬', - email: '[email protected]', + email: '[email protected]', }, { id: 2, profileImageUrl: '...', nickname: 'λͺ¨λλ¬λ', - email: '[email protected]', + email: '[email protected]', }, // ... λ€λ₯Έ μ°Έκ°μλ€λ κ°μ λ°©μμΌλ‘ μμ ]Also applies to: 101-133, 144-176
π Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
π Files selected for processing (15)
src/_apis/detail/get-gathering-detail.ts(0 hunks)src/_apis/detail/get-review-list.ts(0 hunks)src/_apis/gathering/gathering-detail-apis.ts(1 hunks)src/_queries/crew/crew-detail-queries.ts(1 hunks)src/_queries/crew/gathering-list-queries.ts(1 hunks)src/_queries/gathering/gathering-detail-queries.ts(1 hunks)src/app/(crew)/crew/_components/gathering-detail-modal/container.tsx(2 hunks)src/app/(crew)/crew/_components/gathering-detail-modal/gathering-detail-modal.stories.tsx(3 hunks)src/app/(crew)/crew/detail/[id]/_components/detail-crew-section.tsx(1 hunks)src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx(1 hunks)src/app/(crew)/crew/detail/[id]/_components/review-section.tsx(1 hunks)src/app/(crew)/crew/detail/[id]/page.tsx(1 hunks)src/components/common/gathering-card/container.tsx(1 hunks)src/components/common/gathering-card/scheduled-gathering-card/container.tsx(1 hunks)src/types/gathering-data.d.ts(1 hunks)
π€ Files with no reviewable changes (2)
- src/_apis/detail/get-gathering-detail.ts
- src/_apis/detail/get-review-list.ts
β Files skipped from review due to trivial changes (1)
- src/app/(crew)/crew/detail/[id]/_components/review-section.tsx
π Additional comments (15)
src/_queries/crew/crew-detail-queries.ts (2)
Line range hint 4-9: νλ₯ν React Query ꡬνμ
λλ€
useGetCrewDetailQuery ν μ΄ React Queryμ λͺ¨λ² μ¬λ‘λ₯Ό μ λ°λ₯΄κ³ μμ΅λλ€:
- λͺ νν 쿼리 ν€ κ΅¬μ‘°
- νμ μμ μ± ν보
- κ°κ²°νκ³ μ¬μ¬μ© κ°λ₯ν ꡬν
2-2: API κ²½λ‘ κ΅¬μ‘° λ³κ²½ νμΈ νμ
API κ²½λ‘κ° λ λ Όλ¦¬μ μΈ κ΅¬μ‘°λ‘ λ³κ²½λμμ΅λλ€. crew κ΄λ ¨ APIλ€μ νλμ λλ ν λ¦¬λ‘ κ΅¬μ±ν κ²μ μ’μ λ³νμ λλ€.
μλ‘μ΄ API κ΅¬μ‘°κ° μΌκ΄λκ² μ μ©λμλμ§ νμΈνκ² μ΅λλ€:
β Verification successful
API κ²½λ‘ λ³κ²½ νμΈ μλ£
μλ‘μ΄ API κ΅¬μ‘°κ° μΌκ΄λκ² μ μ©λμμΌλ©°, μ΄μ API νμΌλ€μ΄ λͺ¨λ μμ λμμ΅λλ€.
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: crew κ΄λ ¨ APIλ€μ μλ‘μ΄ κ΅¬μ‘° νμΈ
# crew κ΄λ ¨ API νμΌλ€μ μμΉ νμΈ
fd -e ts -p "crew.*apis\.ts$" src/_apis
# μ΄μ ꡬ쑰μ νμΌμ΄ λ¨μμλμ§ νμΈ
fd -e ts -p "get-crew.*\.ts$" src/_apis/detail
Length of output: 272
Script:
#!/bin/bash
# Description: μ΄μ crew κ΄λ ¨ API νμΌλ€μ΄ μμ λμλμ§ νμΈ
# μ΄μ ꡬ쑰μ νμΌλ€μ΄ μ‘΄μ¬νμ§ μλμ§ νμΈ
fd -e ts -p "get-crew.*\.ts$" src/_apis | wc -l
Length of output: 51
src/_queries/gathering/gathering-detail-queries.ts (2)
Line range hint 4-9: νλ₯ν React Query ꡬν
- μ μ ν νμ μ§μ
- μμ‘΄μ±μ ν¬ν¨ν λͺ νν 쿼리 ν€ κ΅¬μ‘°
- κΉλν ν¨μν ꡬν
λͺ¨λ²μ μΈ React Query ν¨ν΄μ μ λ°λ₯΄κ³ μμ΅λλ€.
2-2: API νμΌ κ΅¬μ‘° λ³κ²½ νμΈ νμ
API κ΄λ ¨ νμΌλ€μ κ΅¬μ‘°κ° λ 체κ³μ μΌλ‘ κ°μ λμμ΅λλ€. λ€λ§, μ΄λ¬ν λ³κ²½μ΄ λ€λ₯Έ νμΌλ€μλ μΌκ΄λκ² μ μ©λμλμ§ νμΈμ΄ νμν©λλ€.
λ€μ μ€ν¬λ¦½νΈλ₯Ό μ€ννμ¬ API νμΌ κ΅¬μ‘°μ μΌκ΄μ±μ νμΈνκ² μ΅λλ€:
β Verification successful
API νμΌ κ΅¬μ‘° λ³κ²½μ΄ μΌκ΄λκ² μ μ©λμμ΅λλ€.
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: API νμΌ κ΅¬μ‘°μ μΌκ΄μ± νμΈ
# μ΄μ ꡬ쑰μ νμΌμ΄ λ¨μμλμ§ νμΈ
echo "μ΄μ ꡬ쑰μ νμΌ νμΈ:"
fd -e ts -p "_apis/detail/"
# μλ‘μ΄ κ΅¬μ‘°μ νμΌλ€ νμΈ
echo "\nμλ‘μ΄ κ΅¬μ‘°μ νμΌλ€ νμΈ:"
fd -e ts -p "_apis/gathering/"
Length of output: 185
src/_queries/crew/gathering-list-queries.ts (1)
2-2: API κ²½λ‘ λ³κ²½μ΄ μ¬λ°λ₯΄κ² μ μ©λμλμ§ νμΈμ΄ νμν©λλ€.
import κ²½λ‘κ° crew λ€μμ€νμ΄μ€λ‘ μ΄λλ κ²μ΄ νμΈλμμ΅λλ€. λ€λ₯Έ νμΌλ€μμλ λμΌν λ³κ²½μ΄ νμν μ μμ΅λλ€.
λ€μ μ€ν¬λ¦½νΈλ₯Ό μ€ννμ¬ κΈ°μ‘΄ import κ²½λ‘λ₯Ό μ¬μ©νλ λ€λ₯Έ νμΌλ€μ νμΈν΄λ³΄μΈμ:
β Verification successful
API κ²½λ‘ λ³κ²½μ΄ μ¬λ°λ₯΄κ² μ μ©λμμ΅λλ€.
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any remaining old import paths
rg "@/src/_apis/detail/get-gathering-list"
Length of output: 42
src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx (2)
Line range hint 1-20: μ½λ κ΅¬μ‘°κ° μ ꡬνλμ΄ μμ΅λλ€.
- μ μ ν νμ μ μμ ν¨κ» ν΄λΌμ΄μΈνΈ μ»΄ν¬λνΈλ‘ μ¬λ°λ₯΄κ² μ€μ λμ΄ μμ΅λλ€.
- λ‘λ©, μλ¬, λΉ λ°μ΄ν° μνμ λν μ²λ¦¬κ° μ λμ΄ μμ΅λλ€.
- Props μΈν°νμ΄μ€κ° λͺ ννκ² μ μλμ΄ μμ΅λλ€.
3-3: API κ²½λ‘ λ³κ²½ κ²μ¦μ΄ νμν©λλ€.
import κ²½λ‘κ° detailμμ crewλ‘ λ³κ²½λμμ΅λλ€. μ΄λ API ꡬ쑰 κ°μ μ μΌνμΌλ‘ 보μ΄λ, λ€λ₯Έ μ»΄ν¬λνΈλ€λ μ΄ λ³κ²½μ¬νκ³Ό μΌκ΄μ±μ΄ μλμ§ νμΈμ΄ νμν©λλ€.
β Verification successful
κ²½λ‘ λ³κ²½μ΄ μΌκ΄λκ² λ°μλμμ΅λλ€.
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: νλ‘μ νΈ λ΄μ gathering-list-queries κ΄λ ¨ import κ²½λ‘ μΌκ΄μ± κ²μ¦
# μ΄μ κ²½λ‘ μ¬μ© μ¬λΆ νμΈ
echo "μ΄μ κ²½λ‘ μ¬μ© κ²μ¬:"
rg -l "@/src/_queries/detail/gathering-list-queries"
# μλ‘μ΄ κ²½λ‘ μ¬μ© νμΈ
echo "\nμλ‘μ΄ κ²½λ‘ μ¬μ© κ²μ¬:"
rg -l "@/src/_queries/crew/gathering-list-queries"
Length of output: 250
Script:
#!/bin/bash
# Description: μλ‘μ΄ import κ²½λ‘ μ¬μ© νν© μΆκ° κ²μ¦
echo "μλ‘μ΄ κ²½λ‘ μ 체 μ¬μ© κ²μ¬:"
rg -l "@/src/_queries/crew/gathering-list-queries"
Length of output: 164
src/app/(crew)/crew/detail/[id]/_components/detail-crew-section.tsx (1)
3-5: μν¬νΈ κ΅¬μ‘°κ° κ°μ λμμ΅λλ€!
API κ΄λ ¨ 쿼리λ₯Ό crew ν΄λλ‘ μ΄λνμ¬ λ λͺ νν ꡬ쑰λ₯Ό κ°μ§κ² λμμ΅λλ€.
src/types/gathering-data.d.ts (2)
15-15: crewId νλ μΆκ°κ° μ μ ν΄ λ³΄μ
λλ€.
λͺ¨μκ³Ό ν¬λ£¨μ κ΄κ³λ₯Ό λͺ ννκ² νννκΈ° μν νμμ μΈ νλμ΄λ©°, νμ λ μ μ νκ² μ§μ λμμ΅λλ€.
15-15: crewId νλ μ¬μ© κ²μ¦μ΄ νμν©λλ€.
μλ‘ μΆκ°λ νλκ° API ꡬνμμ μ¬λ°λ₯΄κ² μ¬μ©λλμ§ νμΈμ΄ νμν©λλ€.
β Verification successful
crewId νλ μ¬μ©μ΄ API ꡬνμμ μ¬λ°λ₯΄κ² νμΈλμμ΅λλ€.
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: API ꡬνμμ crewId νλμ μ¬μ©μ νμΈν©λλ€.
# API κ΄λ ¨ νμΌμμ crewId μ¬μ© νμΈ
echo "API νμΌμμ crewId μ¬μ© νμΈ:"
rg -p "crewId" --type ts src/api/
# μ»΄ν¬λνΈμμ crewId μ¬μ© νμΈ
echo "\nμ»΄ν¬λνΈμμ crewId μ¬μ© νμΈ:"
rg -p "crewId.*GatheringDetail" --type tsx src/components/
Length of output: 281
Script:
#!/bin/bash
# Description: μ 체 μ½λλ² μ΄μ€μμ crewId νλμ μ¬μ©μ μ¬νμΈν©λλ€.
# μ 체 μ½λλ² μ΄μ€μμ crewId μ¬μ© νμΈ
echo "μ 체 μ½λλ² μ΄μ€μμ crewId μ¬μ© νμΈ:"
rg "crewId"
# API λλ ν 리μ μ νν κ²½λ‘ μ°ΎκΈ°
echo "\nAPI λλ ν 리 κ²μ:"
fd api --type d
# components λλ ν 리μμ tsx νμΌ μ§μ μ€μ ν crewId μ¬μ© νμΈ
echo "\ncomponents λλ ν 리μμ crewId μ¬μ© λ° GatheringDetail κ΄λ ¨ κ²μ:"
rg "crewId.*GatheringDetail" --glob '*.tsx' src/components/
Length of output: 5177
src/app/(crew)/crew/detail/[id]/page.tsx (1)
1-1: API κ²½λ‘ λ³κ²½ κ²μ¦μ΄ νμν©λλ€.
API ꡬ쑰 λ³κ²½μΌλ‘ μΈν import κ²½λ‘ μμ μ΄ μ¬λ°λ₯΄κ² μ΄λ£¨μ΄μ‘λμ§ νμΈμ΄ νμν©λλ€.
β Verification successful
API κ²½λ‘ λ³κ²½μ΄ μ¬λ°λ₯΄κ² μ μ©λμμ΅λλ€.
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the new API path exists and is consistently used
# Check if the new API file exists
fd "crew-gathering-list-apis.ts$"
# Check for any remaining old import paths
rg "@/src/_apis/detail/get-gathering-list"
# Check for consistency in new import usage
rg "@/src/_apis/crew/crew-gathering-list-apis"
Length of output: 409
src/_apis/gathering/gathering-detail-apis.ts (1)
1-54: API μλν¬μΈνΈ κ²μ¦ νμ
λ°±μλ API λͺ μΈμ μΌμΉνλμ§ νμΈμ΄ νμν©λλ€.
src/app/(crew)/crew/_components/gathering-detail-modal/container.tsx (2)
3-9: API ν΅ν©μ΄ μ¬λ°λ₯΄κ² ꡬνλμμ΅λλ€!
νμν API ν¨μλ€κ³Ό μλ¬ μ²λ¦¬λ₯Ό μν μμ‘΄μ±μ΄ μ ꡬμ±λμ΄ μμ΅λλ€.
19-19:
ν μ€νΈ 컀λ²λ¦¬μ§ κ°μ μ΄ νμν©λλ€.
ν ν° κ΄λ ¨ μ΄μλ‘ μΈν΄ ν μ€νΈκ° λΆκ°λ₯ν μν©μ λλ€. μ΄λ μ½λμ μ λ’°μ±μ μ ν΄ν μ μμ΅λλ€.
λ€μ μ€ν¬λ¦½νΈλ₯Ό μ€ννμ¬ ν μ€νΈ νκ²½μ νμΈν΄λ³΄κ² μ΅λλ€:
src/components/common/gathering-card/container.tsx (1)
5-5: import κ²½λ‘ λ³κ²½ κ²μ¦μ΄ νμν©λλ€.
μλ‘μ΄ import κ²½λ‘κ° μ¬λ°λ₯΄κ² ꡬμ±λμ΄ μλμ§, κ·Έλ¦¬κ³ μ΄ λ³κ²½μ¬νμ΄ μ½λλ² μ΄μ€ μ 체μμ μΌκ΄λκ² μ μ©λμλμ§ νμΈμ΄ νμν©λλ€.
β Verification successful
import κ²½λ‘ λ³κ²½μ΄ νμΈλμμ΅λλ€.
λ³κ²½λ import κ²½λ‘κ° μ¬λ°λ₯΄λ©°, μ½λλ² μ΄μ€ μ λ°μ κ±Έμ³ μΌκ΄λκ² μ μ©λμμ΅λλ€.
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the new import path and its usage across the codebase
# Check if the new path exists
fd "gathering-detail-queries.ts" src/_queries/gathering
# Check for any remaining old import paths
rg "@/src/_queries/detail/gathering-detail-queries"
# Check for consistency of the new import path
rg "@/src/_queries/gathering/gathering-detail-queries"
Length of output: 360
| import { fetchApi } from '@/src/utils/api'; | ||
| import { GatheringDetailType } from '@/src/types/gathering-data'; |
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.
π οΈ Refactor suggestion
API μλ¬ μ²λ¦¬ κ°μ νμ
fetchApi μ νΈλ¦¬ν°λ₯Ό μ¬μ©ν λ λ€νΈμν¬ μ€λ₯λ μλ² μ€λ₯μ λν μ²λ¦¬κ° λλ½λμ΄ μμ΅λλ€. κ° API ν¨μμμ try-catchλ₯Ό μ¬μ©νμ¬ μλ¬λ₯Ό μ μ ν μ²λ¦¬νλ κ²μ΄ μ’μ΅λλ€.
λ€μκ³Ό κ°μ΄ μλ¬ νμ μ μ μνκ³ μ²λ¦¬νλ κ²μ μΆμ²λ립λλ€:
interface ApiError {
message: string;
status: number;
}
// κ° ν¨μμμ μ¬μ©ν μλ¬ μ²λ¦¬ μμ
try {
const response = await fetchApi<{ data: GatheringDetailType }>(url, options);
return response.data;
} catch (error) {
throw new Error(`λͺ¨μ μμΈ μ 보λ₯Ό κ°μ Έμ€λλ° μ€ν¨νμ΅λλ€: ${error.message}`);
}| // NOTE: μ½μ μ°Έμ¬ | ||
| export async function JoinGathering(crewId: number, gatheringId: number): Promise<void> { | ||
| const url = `/api/crews/${crewId}/gatherings/${gatheringId}/join`; | ||
|
|
||
| await fetchApi(url, { | ||
| method: 'POST', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| // NOTE: μ½μ μ·¨μ(host) | ||
| export async function CancelGathering(crewId: number, gatheringId: number): Promise<void> { | ||
| const url = `/api/crews/${crewId}/gatherings/${gatheringId}`; | ||
|
|
||
| await fetchApi(url, { | ||
| method: 'DELETE', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| // NOTE: μ½μ μ°Έμ¬ μ·¨μ(μ°Έμ¬μ) | ||
| export async function LeaveGathering(crewId: number, gatheringId: number): Promise<void> { | ||
| const url = `/api/crews/${crewId}/gatherings/${gatheringId}/leave`; | ||
|
|
||
| await fetchApi(url, { | ||
| method: 'DELETE', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| }); | ||
| } |
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.
π οΈ Refactor suggestion
API ν¨μλ€μ μΌκ΄μ± λ° μμ μ± κ°μ νμ
λͺ¨λ API ν¨μλ€μμ λ€μ μ¬νλ€μ΄ κ°μ λμ΄μΌ ν©λλ€:
- μ λ ₯κ° μ ν¨μ± κ²μ¬κ° λλ½λμ΄ μμ΅λλ€
- μΈμ¦ ν€λκ° λͺ¨λ μμ²μ νμν©λλ€
- μλ΅ νμ μ΄ λͺ μμ μ΄μ§ μμ΅λλ€
λ€μκ³Ό κ°μ κ°μ μ μ μλ립λλ€:
// κ³΅ν΅ νμ
μ μ
interface ApiResponse<T> {
data: T;
message: string;
status: number;
}
// μ
λ ₯κ° κ²μ¦ μ νΈλ¦¬ν°
function validateIds(crewId: number, gatheringId: number) {
if (!Number.isInteger(crewId) || crewId <= 0) {
throw new Error('μ ν¨νμ§ μμ ν¬λ£¨ IDμ
λλ€');
}
if (!Number.isInteger(gatheringId) || gatheringId <= 0) {
throw new Error('μ ν¨νμ§ μμ λͺ¨μ IDμ
λλ€');
}
}
// μμ ν¨μ ꡬν
export async function JoinGathering(crewId: number, gatheringId: number): Promise<ApiResponse<void>> {
validateIds(crewId, gatheringId);
const url = `/api/crews/${crewId}/gatherings/${gatheringId}/join`;
try {
return await fetchApi<ApiResponse<void>>(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${getToken()}`,
},
});
} catch (error) {
throw new Error(`λͺ¨μ μ°Έμ¬μ μ€ν¨νμ΅λλ€: ${error.message}`);
}
}| // NOTE: μ½μ λν μΌ λΆλ¬μ€κΈ° | ||
| export async function GetGatheringDetail( | ||
| crewId: number, | ||
| gatheringId: number, | ||
| ): Promise<GatheringDetailType> { | ||
| const url = `/api/crews/${crewId}/gatherings/${gatheringId}`; | ||
|
|
||
| const response = await fetchApi<{ data: GatheringDetailType }>(url, { | ||
| method: 'GET', | ||
| headers: { | ||
| 'Content-Type': 'application/json', | ||
| }, | ||
| }); | ||
| return response.data; | ||
| } |
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.
μΈμ¦ ν ν° ν€λ μΆκ° νμ
PRμμ μΈκΈλ λ‘κ·ΈμΈ ν ν° λ¬Έμ μ κ΄λ ¨νμ¬, Authorization ν€λκ° λλ½λμ΄ μμ΅λλ€. μΈμ¦μ΄ νμν API νΈμΆμμλ λ°λμ ν ν°μ ν¬ν¨ν΄μΌ ν©λλ€.
λ€μκ³Ό κ°μ΄ μμ ν΄μ£ΌμΈμ:
const response = await fetchApi<{ data: GatheringDetailType }>(url, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
+ 'Authorization': `Bearer ${getToken()}`,
},
});Committable suggestion skipped: line range outside the PR's diff.
| const handleJoin = async () => { | ||
| try { | ||
| await JoinGathering(data.crewId, data.id); | ||
| showToast('μ½μμ μ°Έμ¬νμ΅λλ€.', 'success'); | ||
| close(); | ||
| } catch (error) { | ||
| if (error instanceof ApiError) { | ||
| showToast(`μ°Έμ¬ μ€ μλ¬ λ°μ: ${error.message}`, 'error'); | ||
| } | ||
| } | ||
| }; | ||
| const handleDelete = () => { | ||
| // TODO : λͺ¨μ μμ νκΈ° API μ°κ²° | ||
| close(); | ||
|
|
||
| const handleExit = async () => { | ||
| try { | ||
| await LeaveGathering(data.crewId, data.id); | ||
| close(); | ||
| } catch (error) { | ||
| if (error instanceof ApiError) { | ||
| showToast(`μ°Έμ¬ μ·¨μ μ€ μλ¬ λ°μ: ${error.message}`, 'error'); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| const handleDelete = async () => { | ||
| try { | ||
| await CancelGathering(data.crewId, data.id); | ||
| showToast('μ½μμ μμ νμ΅λλ€.', 'success'); | ||
| close(); | ||
| } catch (error) { | ||
| if (error instanceof ApiError) { | ||
| showToast(`μ½μ μμ μ€ μλ¬ λ°μ: ${error.message}`, 'error'); | ||
| } | ||
| } |
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.
π οΈ Refactor suggestion
API νΈλ€λ¬μ μΌκ΄μ± κ°μ μ΄ νμν©λλ€.
handleExitν¨μμ μ±κ³΅ λ©μμ§κ° λλ½λμ΄ μμ΅λλ€.- μλ¬ μ²λ¦¬κ° κ° νΈλ€λ¬μμ λ°λ³΅λκ³ μμ΅λλ€.
λ€μκ³Ό κ°μ κ°μ μ¬νμ μ μλ립λλ€:
const handleExit = async () => {
try {
await LeaveGathering(data.crewId, data.id);
+ showToast('μ½μ μ°Έμ¬λ₯Ό μ·¨μνμ΅λλ€.', 'success');
close();
} catch (error) {μλ¬ μ²λ¦¬λ₯Ό μν μ νΈλ¦¬ν° ν¨μλ₯Ό μΆκ°νλ©΄ μ’μ κ² κ°μ΅λλ€:
const handleApiError = (error: unknown, context: string) => {
if (error instanceof ApiError) {
showToast(`${context} μ€ μλ¬ λ°μ: ${error.message}`, 'error');
}
};μ΄λ₯Ό νμ©νμ¬ κ° νΈλ€λ¬μ μλ¬ μ²λ¦¬λ₯Ό λ¨μνν μ μμ΅λλ€:
} catch (error) {
- if (error instanceof ApiError) {
- showToast(`μ½μ μμ μ€ μλ¬ λ°μ: ${error.message}`, 'error');
- }
+ handleApiError(error, 'μ½μ μμ ');
}
yulrang
left a comment
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.
μλ§¨ν± νκ·Έλ₯Ό μ μ νκ² μ¬μ©ν΄μ£Όμ
¨λ€μ~~ μ’μ΅λλ€
μκ³ λ§μΌμ
¨μ΄μ~!!
minkyung5x5
left a comment
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.
μκ³ νμ ¨μ΅λλ·!!!!
π Issue Ticket
#111
βοΈ Description
β Checklist
PR
Test
Summary by CodeRabbit
New Features
GatheringDetailTypeμcrewIdμμ± μΆκ°λ‘ λͺ¨μ μ 보μ μΈλΆμ¬ν ν₯μ.Bug Fixes
Documentation
crewIdμμ± μΆκ°λ‘ λͺ¨μ μΈλΆμ 보μ λν ν μ€νΈ λ°μ΄ν° κ°ν.Refactor