Skip to content

fix: 중복되는 티켓 옵션 타입 수정#156

Merged
xaexunxang merged 1 commit intodevelopfrom
fix/#155/ticket-option-type-rename
May 30, 2025
Merged

fix: 중복되는 티켓 옵션 타입 수정#156
xaexunxang merged 1 commit intodevelopfrom
fix/#155/ticket-option-type-rename

Conversation

@xaexunxang
Copy link
Copy Markdown
Contributor

@xaexunxang xaexunxang commented May 30, 2025

  1. src/features/ticket/api/ticketOption.ts 파일에서 TicketOptionResponse 타입이 충돌이 일어남
  2. src/features/ticket/model/ticketOption.ts 파일에서 TicketOptionResponse을 TicketOptionTypeResponse로 수정
  3. src/features/ticket/api/ticketOption.ts 파일에서 티켓 옵션 부착 페이지에 해당하는 TicketOptionResponse 만 TicketOptionTypeResponse로 수정
  4. src/features/ticket/hooks/useTicketOptionHook.ts 파일에서 티켓 옵션 부착 페이지에 해당하는 TicketOptionResponse 만 TicketOptionTypeResponse로 수정
  5. src/features/ticket/model/ticketOptionReducer.ts 파일에서 타입 이름 수정

@xaexunxang xaexunxang requested review from Yejiin21 and hyeeuncho May 30, 2025 14:12
@xaexunxang xaexunxang self-assigned this May 30, 2025
@xaexunxang xaexunxang added the 🛠️ BugFix 오류 해결 과정 기록 label May 30, 2025
@xaexunxang xaexunxang linked an issue May 30, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented May 30, 2025

Walkthrough

이 변경사항은 티켓 옵션 관련 API 함수, React 쿼리 훅, 그리고 타입 정의에서 기존의 TicketOptionResponseTicketOptionTypeResponse로 일괄적으로 변경하고, 새로운 티켓 옵션 생성 훅을 추가합니다. 코드 로직에는 변화가 없으며 타입과 임포트만 수정되었습니다.

Changes

파일 경로 변경 요약
src/features/ticket/model/ticketOption.ts TicketOptionResponse 인터페이스를 TicketOptionTypeResponse로 이름 변경
src/features/ticket/api/ticketOption.ts 모든 관련 함수의 반환 타입 및 axios 제네릭을 TicketOptionTypeResponse로 변경, 임포트 수정
src/features/ticket/hooks/useTicketOptionHook.ts React Query 훅 반환 타입을 TicketOptionTypeResponse로 변경, 티켓 옵션 생성 훅 추가, 임포트 정리

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant useCreateTicketOptionMutation
    participant API
    participant Router

    UI->>useCreateTicketOptionMutation: 티켓 옵션 생성 요청
    useCreateTicketOptionMutation->>API: createTicketOption(data)
    API-->>useCreateTicketOptionMutation: TicketOptionTypeResponse 반환
    useCreateTicketOptionMutation->>UI: 성공 알림
    useCreateTicketOptionMutation->>Router: /dashboard/event/:eventId/ticket-option으로 이동
Loading

Possibly related issues

Suggested reviewers

  • Yejiin21

Poem

토끼가 깡충, 타입 이름 바꿔요
오래된 이름, 새 옷을 입어요
옵션도 쿼리도, 모두 통일했죠
새 훅도 추가해, 흐름이 매끄럽게
코드밭에 봄바람, 타입이 춤춰요! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Copy Markdown

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/features/ticket/model/ticketOption.ts (1)

60-60: 타입 별칭의 명확성을 위한 개선 제안

ESLint가 지적한 바와 같이, 멤버가 없는 인터페이스는 상위 타입과 동일합니다. 타입 별칭 사용을 고려해보세요.

다음과 같이 타입 별칭으로 변경하는 것을 권장합니다:

-export interface TicketOptionTypeResponse extends ApiResponse<TicketOptionsType> {}
+export type TicketOptionTypeResponse = ApiResponse<TicketOptionsType>;

이렇게 하면 ESLint 경고를 해결하고 의도를 더 명확하게 표현할 수 있습니다.

🧰 Tools
🪛 ESLint

[error] 60-60: An interface declaring no members is equivalent to its supertype.

(@typescript-eslint/no-empty-object-type)

src/features/ticket/hooks/useTicketOptionHook.ts (1)

79-94: 새로운 티켓 옵션 생성 훅 구현 검토

새로 추가된 useCreateTicketOptionMutation 훅이 잘 구현되었습니다. URL 파라미터에서 eventId를 가져와 자동으로 설정하고, 성공/실패 시 적절한 피드백을 제공합니다.

다만 다음 사항을 고려해보세요:

  • Number(id) 변환 시 id가 undefined이거나 유효하지 않은 경우에 대한 처리
  • navigate 경로가 하드코딩되어 있어 라우팅 구조 변경 시 유지보수가 어려울 수 있음
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0edde47 and 621c6cf.

📒 Files selected for processing (3)
  • src/features/ticket/api/ticketOption.ts (3 hunks)
  • src/features/ticket/hooks/useTicketOptionHook.ts (6 hunks)
  • src/features/ticket/model/ticketOption.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
src/features/ticket/model/ticketOption.ts (1)
src/shared/types/api/apiResponse.ts (1)
  • ApiResponse (1-5)
src/features/ticket/hooks/useTicketOptionHook.ts (1)
src/features/ticket/model/ticketOption.ts (1)
  • TicketOptionTypeResponse (60-60)
src/features/ticket/api/ticketOption.ts (2)
src/features/ticket/model/ticketOption.ts (2)
  • TicketOptionRequest (39-46)
  • TicketOptionTypeResponse (60-60)
src/shared/types/api/http-client.ts (1)
  • axiosClient (6-13)
🪛 ESLint
src/features/ticket/model/ticketOption.ts

[error] 60-60: An interface declaring no members is equivalent to its supertype.

(@typescript-eslint/no-empty-object-type)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: storybook
🔇 Additional comments (5)
src/features/ticket/api/ticketOption.ts (3)

36-38: API 함수 반환 타입 업데이트 확인

createTicketOption 함수의 반환 타입이 TicketOptionTypeResponse로 올바르게 업데이트되었습니다.


57-71: GET API 함수들의 타입 일관성 확인

모든 조회 관련 API 함수들(getTicketOptions, getAttachedTicketOptions, getTicketOptionDetail)의 반환 타입이 TicketOptionTypeResponse로 일관되게 업데이트되었습니다.


2-4:

Details

✅ Verification successful

타입 네이밍의 일관성 확인

TicketOptionTypeResponse로의 타입 변경이 올바르게 적용되었습니다. 다만 4번째 줄에서 TicketOptionResponse를 여전히 import하고 있는데, 이는 ticketInformation 모델의 다른 타입인 것으로 보입니다.

타입 네이밍 충돌을 방지하기 위해 다음 스크립트로 유사한 타입명들의 사용을 확인해보세요:


🏁 Script executed:

#!/bin/bash
# 설명: TicketOption으로 시작하는 모든 타입과 인터페이스 찾기

# TicketOption으로 시작하는 타입/인터페이스 정의 검색
rg -A 3 "(interface|type)\s+TicketOption" 

# TicketOptionResponse 사용처 검색 (변경되지 않은 곳이 있는지 확인)
echo "=== TicketOptionResponse 사용처 ==="
rg "TicketOptionResponse" --type ts

Length of output: 5522


타입 네이밍 구분 확인 및 승인

TicketOptionTypeResponse(API 응답 래퍼)와 TicketOptionResponse(도메인 모델)가 의도대로 분리되어 사용되고 있으며, 현재 import된 TicketOptionResponse는 여러 곳에서 실제 도메인 데이터를 처리하기 위해 꼭 필요합니다. 삭제나 변경 없이 그대로 두셔도 괜찮습니다.

다만, 향후 혼동을 줄이기 위해 아래와 같은 보다 구체적인 네이밍을 고려해볼 수 있습니다:

  • API 응답 타입 → ApiTicketOptionResponse 또는 TicketOptionApiResponse
  • 도메인 모델 타입 → TicketOptionData 또는 TicketOptionDomain

확인된 TicketOptionResponse 사용 위치:

  • src/shared/ui/backgrounds/TicketOptionLayout.tsx
  • src/pages/dashboard/ui/ticket/TicketOptionResponsePage.tsx
  • src/features/ticket/hooks/useTicketOptionHook.ts
  • src/features/ticket/api/ticketOption.ts
  • src/features/payment/ui/TicketOption.tsx
src/features/ticket/hooks/useTicketOptionHook.ts (2)

1-4: Import 구문 정리 및 타입 업데이트

새로운 의존성들과 업데이트된 타입이 올바르게 import되었습니다. TicketOptionTypeResponse 타입으로의 변경이 적절히 반영되었습니다.


141-163: React Query 훅들의 타입 업데이트 확인

모든 조회 관련 훅들(useGetTicketOptions, useGetAttachedTicketOptions, useGetTicketOptionDetail)의 제네릭 타입이 TicketOptionTypeResponse로 일관되게 업데이트되었습니다.

@xaexunxang xaexunxang merged commit a50ff9a into develop May 30, 2025
2 checks passed
@xaexunxang xaexunxang deleted the fix/#155/ticket-option-type-rename branch May 30, 2025 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛠️ BugFix 오류 해결 과정 기록

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fix] 중복되는 티켓 옵션 타입 이름 수정

2 participants