diff --git a/public/svgs/icon_download.svg b/public/svgs/icon_download.svg
new file mode 100644
index 00000000..60f11990
--- /dev/null
+++ b/public/svgs/icon_download.svg
@@ -0,0 +1,3 @@
+
diff --git a/src/apis/domains/tickets/api.ts b/src/apis/domains/tickets/api.ts
index 1bedb136..c0f4e965 100644
--- a/src/apis/domains/tickets/api.ts
+++ b/src/apis/domains/tickets/api.ts
@@ -3,6 +3,7 @@ import { components } from "@typings/api/schema";
import { ApiResponseType } from "@typings/commonType";
import { PatchFormDataProps } from "@typings/deleteBookerFormatProps";
import { AxiosResponse } from "axios";
+import { convertingScheduleNumber } from "@constants/convertingScheduleNumber";
// 예매자 목록 조회 API (GET)
export interface getTicketReq {
@@ -15,11 +16,42 @@ export interface getTicketReq {
type TicketRetrieveResponse = components["schemas"]["TicketRetrieveResponse"];
export const getTicketRetrieve = async (
- formData: getTicketReq
+ formData: getTicketReq,
+ filterList
): Promise => {
try {
+ const params = new URLSearchParams();
+ filterList.scheduleNumber.map((item) =>
+ params.append("scheduleNumbers", convertingScheduleNumber(item))
+ );
+ filterList.bookingStatus.map((item) => params.append("bookingStatuses", item));
+
+ const response: AxiosResponse> = await get(
+ `tickets/${formData.performanceId}?${params.toString()}`
+ );
+
+ return response.data.data;
+ } catch (error) {
+ console.log("error", error);
+ return null;
+ }
+};
+
+export const getTicketRetrieveSearch = async (
+ formData: getTicketReq,
+ searchWord,
+ filterList
+): Promise => {
+ try {
+ const params = new URLSearchParams();
+ params.append("searchWord", searchWord);
+ filterList.scheduleNumber.map((item) =>
+ params.append("scheduleNumbers", convertingScheduleNumber(item))
+ );
+ filterList.bookingStatus.map((item) => params.append("bookingStatuses", item));
+
const response: AxiosResponse> = await get(
- `tickets/${formData.performanceId}`
+ `tickets/search/${formData.performanceId}?${params.toString()}`
);
return response.data.data;
@@ -29,17 +61,11 @@ export const getTicketRetrieve = async (
}
};
+type SuccessResponseVoid = components["schemas"]["SuccessResponseVoid"];
+
// 예매자 입급 여부 수정 API (PUT)
-/*
-export interface putTicketReq {
- performanceId: number;
- performanceTitle: string;
- totalScheduleCoun: number;
- bookingList: BookingListProps[];
-}
-*/
+
export type TicketUpdateRequest = components["schemas"]["TicketUpdateRequest"];
-type SuccessResponseVoid = components["schemas"]["SuccessResponseVoid"];
//async 함수는 항상 promise로 감싸서 값을 리턴한다.
//즉, 비동기 함수의 값을 사용하려면 추후 await이나 then 을 사용해야 한다던데..
@@ -49,7 +75,7 @@ export const putTicketUpdate = async (
): Promise => {
try {
const response: AxiosResponse> = await put(
- "tickets",
+ "tickets/update",
formData
);
@@ -60,18 +86,39 @@ export const putTicketUpdate = async (
}
};
-// 예매자 취소 API (PATCH)
-//이거 타입 잘못되었을 수도..? bookingList 가 number를 담은 배열로 되어 있는데, 실제로는 아니었음
-//export type TicketDeleteRequest = components["schemas"]["TicketDeleteRequest"];
+// 예매자 환불처리 (PUT)
+
+export type TicketRefundRequest = components["schemas"]["TicketRefundRequest"];
-export const patchTicketCancel = async (
- formData: PatchFormDataProps
+export const putTicketRefund = async (
+ formData: TicketRefundRequest
): Promise => {
try {
- const response: AxiosResponse> = await patch(
- "tickets",
+ const response: AxiosResponse> = await put(
+ "tickets/refund",
formData
);
+
+ return response.data.data;
+ } catch (error) {
+ console.log("error", error);
+ return null;
+ }
+};
+
+// 예매자 삭제 (PUT)
+
+export type TicketDeleteRequest = components["schemas"]["TicketDeleteRequest"];
+
+export const putTicketDelete = async (
+ formData: TicketDeleteRequest
+): Promise => {
+ try {
+ const response: AxiosResponse> = await put(
+ "tickets/delete",
+ formData
+ );
+
return response.data.data;
} catch (error) {
console.log("error", error);
diff --git a/src/apis/domains/tickets/queries.ts b/src/apis/domains/tickets/queries.ts
index 133d8dd4..1088484b 100644
--- a/src/apis/domains/tickets/queries.ts
+++ b/src/apis/domains/tickets/queries.ts
@@ -1,10 +1,13 @@
import { QueryClient, useMutation, useQuery } from "@tanstack/react-query";
-import { PatchFormDataProps } from "@typings/deleteBookerFormatProps";
import {
getTicketReq,
getTicketRetrieve,
- patchTicketCancel,
+ getTicketRetrieveSearch,
+ putTicketDelete,
+ putTicketRefund,
putTicketUpdate,
+ TicketDeleteRequest,
+ TicketRefundRequest,
TicketUpdateRequest,
} from "./api";
@@ -13,19 +16,30 @@ const QUERY_KEY = {
SELLER_BOOKING_LIST: "sellerBookingList",
};
-export const useTicketRetrive = (formData: getTicketReq) => {
+export const useTicketRetrive = (formData: getTicketReq, filterList) => {
return useQuery({
queryKey: [QUERY_KEY.SELLER_BOOKING_LIST],
- queryFn: () => getTicketRetrieve(formData),
- // staleTime: 1000 * 60 * 60,
+ queryFn: () => getTicketRetrieve(formData, filterList),
+ staleTime: 1000 * 60 * 60,
gcTime: 1000 * 60 * 60 * 24,
});
};
+// 예매자 목록 검색 API (GET)를 위한 쿼리 작성
+
+export const useTicketRetriveSearch = (formData: getTicketReq, searchWord, filterList) => {
+ return useQuery({
+ queryKey: [QUERY_KEY.SELLER_BOOKING_LIST],
+ queryFn: () => getTicketRetrieveSearch(formData, searchWord, filterList),
+ staleTime: 1000 * 60 * 60,
+ gcTime: 1000 * 60 * 60 * 24,
+ });
+};
+
+const queryClient = new QueryClient();
+
// 예매자 입급 여부 수정 API (PUT)를 위한 쿼리 작성
export const useTicketUpdate = () => {
- const queryClient = new QueryClient();
-
return useMutation({
mutationFn: (formData: TicketUpdateRequest) => putTicketUpdate(formData),
onSuccess: (res) => {
@@ -35,12 +49,21 @@ export const useTicketUpdate = () => {
});
};
-// 예매자를 취소하는 API (PATCH)를 위한 쿼리 작성
-export const useTicketPatch = () => {
- const queryClient = new QueryClient();
+// 예매자 환불 여부 수정 API (PUT)를 위한 쿼리 작성
+export const useTicketRefund = () => {
+ return useMutation({
+ mutationFn: (formData: TicketRefundRequest) => putTicketRefund(formData),
+ onSuccess: (res) => {
+ queryClient.invalidateQueries({ queryKey: [QUERY_KEY.SELLER_BOOKING_LIST] });
+ queryClient.refetchQueries({ queryKey: [QUERY_KEY.SELLER_BOOKING_LIST] });
+ },
+ });
+};
+// 예매자 삭제 여부 수정 API (PUT)를 위한 쿼리 작성
+export const useTicketDelete = () => {
return useMutation({
- mutationFn: (formData: PatchFormDataProps) => patchTicketCancel(formData),
+ mutationFn: (formData: TicketDeleteRequest) => putTicketDelete(formData),
onSuccess: (res) => {
queryClient.invalidateQueries({ queryKey: [QUERY_KEY.SELLER_BOOKING_LIST] });
queryClient.refetchQueries({ queryKey: [QUERY_KEY.SELLER_BOOKING_LIST] });
diff --git a/src/assets/svgs/IconDownload.tsx b/src/assets/svgs/IconDownload.tsx
new file mode 100644
index 00000000..6a448b89
--- /dev/null
+++ b/src/assets/svgs/IconDownload.tsx
@@ -0,0 +1,11 @@
+import * as React from "react";
+import type { SVGProps } from "react";
+const SvgIconDownload = (props: SVGProps) => (
+
+);
+export default SvgIconDownload;
diff --git a/src/assets/svgs/IconSearch.tsx b/src/assets/svgs/IconSearch.tsx
index 9ee48803..6305f24d 100644
--- a/src/assets/svgs/IconSearch.tsx
+++ b/src/assets/svgs/IconSearch.tsx
@@ -3,7 +3,7 @@ import type { SVGProps } from "react";
const SvgIconSearch = (props: SVGProps) => (