-
Notifications
You must be signed in to change notification settings - Fork 0
fix: 내 티켓 페이지 개선 #148
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
fix: 내 티켓 페이지 개선 #148
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a698cca
fix: 티켓 취소 end-point 에러 수정
Yejiin21 641773f
refac: 겹치는 타입 enum으로 변경
Yejiin21 ad14129
reafac: api 응답 타입 컨벤션에 맞게 수정
Yejiin21 c05b12b
refac: 응답 타입 model 파일에 정의
Yejiin21 70648f1
feat: 내 티켓 페이지에 티켓 취소 기능 퍼블리싱
Yejiin21 c37bf61
feat: 티켓 취소 API 연동
Yejiin21 dc514f5
feat: 이벤트 시작 날짜 이후로는 오더 취소 안되도록 설정
Yejiin21 ab9454e
fix: 파일 경로 에러 수정
Yejiin21 f55f997
rafac: startTime·endTime 제거 반영
Yejiin21 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,53 +1,64 @@ | ||
| import { useMutation, useQuery } from "@tanstack/react-query"; | ||
| import { PersonalTicketOptionAnswerResponse, TicketOptionAnswerRequest, TicketOptionAnswerResponse, TicketOptionResponse, TicketResponse } from "../model/ticketInformation"; | ||
| import { createTicketOptionAnswers, readPersonalTicketOptionAnswers, readPurchaserAnswers, readTicketOptions } from "../api/ticketOption"; | ||
| import { useMutation, useQuery } from '@tanstack/react-query'; | ||
| import { | ||
| PersonalTicketOptionAnswerResponse, | ||
| TicketOptionAnswerRequest, | ||
| TicketOptionAnswerResponse, | ||
| TicketOptionResponse, | ||
| } from '../model/ticketInformation'; | ||
| import { | ||
| createTicketOptionAnswers, | ||
| readPersonalTicketOptionAnswers, | ||
| readPurchaserAnswers, | ||
| readTicketOptions, | ||
| } from '../api/ticketOption'; | ||
| import { ApiResponse } from '../../../shared/types/api/apiResponse'; | ||
|
|
||
| // 티켓 옵션 조회 | ||
| export const useTicketOptions = (ticketId: number) => { | ||
| return useQuery<{ isSuccess: boolean; result: TicketOptionResponse[] }>({ | ||
| queryKey: ['ticketOptions', ticketId], | ||
| queryFn: () => readTicketOptions(ticketId), | ||
| enabled: !!ticketId, | ||
| }); | ||
| return useQuery<{ isSuccess: boolean; result: TicketOptionResponse[] }>({ | ||
| queryKey: ['ticketOptions', ticketId], | ||
| queryFn: () => readTicketOptions(ticketId), | ||
| enabled: !!ticketId, | ||
| }); | ||
| }; | ||
|
|
||
| // 티켓 옵션 응답 전송 | ||
| export const useCreateTicketOptionAnswers = () => { | ||
| return useMutation<TicketResponse, Error, TicketOptionAnswerRequest>({ | ||
| mutationFn: createTicketOptionAnswers, | ||
| onSuccess: () => { | ||
| console.log("티켓 옵션 응답 전송 성공"); | ||
| }, | ||
| onError: () => { | ||
| alert("티켓 옵션 응답 전송 중 오류가 발생했습니다."); | ||
| }, | ||
| }); | ||
| return useMutation<ApiResponse<null>, Error, TicketOptionAnswerRequest>({ | ||
| mutationFn: createTicketOptionAnswers, | ||
| onSuccess: () => { | ||
| console.log('티켓 옵션 응답 전송 성공'); | ||
| }, | ||
| onError: () => { | ||
| alert('티켓 옵션 응답 전송 중 오류가 발생했습니다.'); | ||
| }, | ||
| }); | ||
| }; | ||
|
|
||
| // 티켓 옵션 응답 전체 조회 | ||
| export const usePurchaserAnswers = (ticketId: number | null) => { | ||
| return useQuery<{ isSuccess: boolean; result: TicketOptionAnswerResponse[] }>({ | ||
| queryKey: ['purchaserAnswers', ticketId], | ||
| queryFn: () => { | ||
| if (ticketId === null) { | ||
| throw new Error("ticketId is required"); | ||
| } | ||
| return readPurchaserAnswers(ticketId); | ||
| }, | ||
| enabled: !!ticketId, | ||
| }); | ||
| return useQuery<{ isSuccess: boolean; result: TicketOptionAnswerResponse[] }>({ | ||
| queryKey: ['purchaserAnswers', ticketId], | ||
| queryFn: () => { | ||
| if (ticketId === null) { | ||
| throw new Error('ticketId is required'); | ||
| } | ||
| return readPurchaserAnswers(ticketId); | ||
| }, | ||
| enabled: !!ticketId, | ||
| }); | ||
| }; | ||
|
|
||
| // 티켓 옵션 응답 개별 조회 | ||
| export const usePersonalTicketOptionAnswers = (ticketId: number | null) => { | ||
| return useQuery<{ isSuccess: boolean; result: PersonalTicketOptionAnswerResponse[] }>({ | ||
| queryKey: ['personalTicketOptionAnswers', ticketId], | ||
| queryFn: () => { | ||
| if (ticketId === null) { | ||
| throw new Error("ticketId is required"); | ||
| } | ||
| return readPersonalTicketOptionAnswers(ticketId); | ||
| }, | ||
| enabled: !!ticketId, | ||
| }); | ||
| }; | ||
| return useQuery<{ isSuccess: boolean; result: PersonalTicketOptionAnswerResponse[] }>({ | ||
| queryKey: ['personalTicketOptionAnswers', ticketId], | ||
| queryFn: () => { | ||
| if (ticketId === null) { | ||
| throw new Error('ticketId is required'); | ||
| } | ||
| return readPersonalTicketOptionAnswers(ticketId); | ||
| }, | ||
| enabled: !!ticketId, | ||
| }); | ||
| }; |
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,5 +1,27 @@ | ||
| import { OnlineType } from '../../../shared/types/baseEventType'; | ||
|
|
||
| export interface OrderTicketRequest { | ||
| ticketId: number; | ||
| eventId: number; | ||
| ticketCnt: number; | ||
| } | ||
| ticketId: number; | ||
| eventId: number; | ||
| ticketCnt: number; | ||
| } | ||
|
|
||
| export interface OrderTicketResponse { | ||
| id: number; | ||
| event: { | ||
| id: number; | ||
| bannerImageUrl: string; | ||
| title: string; | ||
| hostChannelName: string; | ||
| address: string; | ||
| startDate: string; | ||
| remainDays: string; | ||
| hashtags: string[]; | ||
| onlineType: OnlineType; | ||
| }; | ||
| ticketQrCode: string; | ||
| ticketName: string; | ||
| ticketPrice: number; | ||
| orderStatus: 'COMPLETED' | 'PENDING' | 'CANCELED'; | ||
| checkIn: boolean; | ||
| } |
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.
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.
💡 Verification agent
🧩 Analysis chain
API 스펙 변경이 반영되었습니다.
startTime과endTime필드가 제거되었습니다. 이 변경사항이 백엔드 API와 일치하는지 확인이 필요합니다.다음 스크립트를 실행하여 CreateTicketRequest 사용처를 확인합니다:
🏁 Script executed:
Length of output: 8537
🏁 Script executed:
Length of output: 1307
startTime·endTime 제거 반영: UI 상태 타입 및 구현 동기화 필요
백엔드 API 스펙에 맞춰
CreateTicketRequest에서startTime·endTime을 제거하셨으나, 아래 UI 코드들이 여전히 해당 필드를 사용하고 있어 타입 불일치 및 런타임 오류가 발생합니다. API용 타입과 폼용 상태를 분리하거나, UI 상태 타입을 별도로 선언하여 구현을 수정해주세요.주의할 파일 및 위치:
•
useState<CreateTicketRequest>({... startTime: '06:00', endTime: '23:00' })•
onDateChange인자 · 훅 의존성 배열에startTime,endTime참조•
ticketData상태에startTime,endTime할당CreateTicketRequest사용처 전체 점검제안:
TicketFormState)로 관리startDate,endDate만 API에 전달하도록 매핑 로직 추가🤖 Prompt for AI Agents