From 1afbfb2d63807cf6cfbbb91789dbfab1aa6cc11c Mon Sep 17 00:00:00 2001 From: hojooo Date: Sun, 17 May 2026 23:06:28 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=A0=91?= =?UTF-8?q?=EA=B7=BC=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/App.tsx | 8 -- src/pages/BatchPage.tsx | 142 ------------------------------- src/shared/api/adminEndpoints.ts | 31 ------- src/shared/api/adminTypes.ts | 17 ---- tests/e2e/admin-routes.spec.ts | 22 +---- 5 files changed, 1 insertion(+), 219 deletions(-) delete mode 100644 src/pages/BatchPage.tsx diff --git a/src/app/App.tsx b/src/app/App.tsx index e42b9cf..a67fb6c 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -1,5 +1,4 @@ import { - CloudSyncOutlined, DashboardOutlined, FileTextOutlined, FolderOpenOutlined, @@ -13,7 +12,6 @@ import type { MenuProps } from "antd"; import type { ReactNode } from "react"; import { Link, Navigate, Outlet, Route, Routes, useLocation, useNavigate } from "react-router"; -import { BatchPage } from "../pages/BatchPage"; import { CollectionsPage } from "../pages/CollectionsPage"; import { ContentPage } from "../pages/ContentPage"; import { LoginPage } from "../pages/LoginPage"; @@ -51,11 +49,6 @@ const navigationItems: MenuProps["items"] = [ key: "/admin/terms", icon: , label: 약관 관리 - }, - { - key: "/admin/batch", - icon: , - label: 데이터 업데이트 } ]; @@ -143,7 +136,6 @@ export function App() { } /> } /> } /> - } /> } /> diff --git a/src/pages/BatchPage.tsx b/src/pages/BatchPage.tsx deleted file mode 100644 index 222a4ce..0000000 --- a/src/pages/BatchPage.tsx +++ /dev/null @@ -1,142 +0,0 @@ -import { useMutation } from "@tanstack/react-query"; -import { App as AntApp, Button, Card, DatePicker, Descriptions, Form, Select, Typography } from "antd"; -import type { Dayjs } from "dayjs"; - -import { triggerBatch } from "../shared/api/adminEndpoints"; -import type { BatchTriggerReq, BatchType, MediaType } from "../shared/api/adminTypes"; - -interface BatchFormValues { - type: BatchType; - date?: Dayjs; - mediaType: MediaType; - startDate?: Dayjs; - endDate?: Dayjs; -} - -export function BatchPage() { - const { message } = AntApp.useApp(); - const [form] = Form.useForm(); - const selectedBatchType = Form.useWatch("type", form) ?? "movies"; - const batchMutation = useMutation({ - mutationFn: (values: BatchTriggerReq) => triggerBatch(values), - onSuccess: () => { - void message.success("데이터 업데이트를 시작했습니다."); - } - }); - - const handleFinish = (values: BatchFormValues) => { - batchMutation.mutate({ - type: values.type, - date: formatOptionalDate(values.date), - mediaType: values.mediaType, - startDate: formatOptionalDate(values.startDate), - endDate: formatOptionalDate(values.endDate) - }); - }; - - return ( -
-
-
- 데이터 업데이트 - 영화, TV, OTT 정보를 최신 상태로 갱신합니다. 필요한 항목만 선택해 실행하세요. -
-
- -
- - - form={form} - layout="vertical" - requiredMark={false} - initialValues={{ type: "movies", mediaType: "MOVIE" }} - onFinish={handleFinish} - > - - - - ) : null} - - {selectedBatchType === "delta" ? ( - <> - - - - - - - - ) : null} - - - - - - - {batchMutation.data ? ( - - {formatBatchJobName(batchMutation.data.jobName)} - {batchMutation.data.executionId} - {formatBatchStatus(batchMutation.data.status)} - {batchMutation.data.createTime.replace("T", " ")} - - ) : ( - 업데이트를 시작하면 진행 상태가 여기에 표시됩니다. - )} - -
-
- ); -} - -function formatOptionalDate(value: Dayjs | undefined) { - return value?.format("YYYY-MM-DD"); -} - -function formatBatchJobName(value: string) { - const labels: Record = { - tmdbMovieImportJob: "영화 정보 가져오기", - tmdbTvImportJob: "TV 정보 가져오기", - ottProviderSyncJob: "OTT 정보 맞추기", - tmdbDeltaImportJob: "변경된 정보 가져오기" - }; - - return labels[value] ?? value; -} - -function formatBatchStatus(value: string) { - const labels: Record = { - STARTING: "시작 중", - STARTED: "진행 중", - COMPLETED: "완료", - FAILED: "실패", - STOPPED: "중지됨" - }; - - return labels[value] ?? value; -} diff --git a/src/shared/api/adminEndpoints.ts b/src/shared/api/adminEndpoints.ts index d3e221c..db0cae0 100644 --- a/src/shared/api/adminEndpoints.ts +++ b/src/shared/api/adminEndpoints.ts @@ -13,8 +13,6 @@ import type { AdminLoginRes, AdminRefreshTokenReq, AdminUserStatisticsRes, - BatchJobExecutionRes, - BatchTriggerReq, CollectionModerationStatus, MediaType, PaginationResponse, @@ -124,35 +122,6 @@ export function createTerms(request: TermsCreateReq) { }); } -export function triggerBatch(request: BatchTriggerReq) { - const mediaType = request.mediaType ?? "MOVIE"; - - if (request.type === "movies") { - return postBatch("/admin/batch/movies", { date: request.date }); - } - - if (request.type === "tv") { - return postBatch("/admin/batch/tv", { date: request.date }); - } - - if (request.type === "ott") { - return postBatch("/admin/batch/ott", { mediaType }); - } - - return postBatch("/admin/batch/delta", { - mediaType, - startDate: request.startDate, - endDate: request.endDate - }); -} - -function postBatch(path: string, params: object) { - return adminApi(withQuery(path, params), { - method: "POST", - rawResponse: true - }); -} - function withQuery(path: string, params: object) { const searchParams = new URLSearchParams(); diff --git a/src/shared/api/adminTypes.ts b/src/shared/api/adminTypes.ts index 670b319..569b236 100644 --- a/src/shared/api/adminTypes.ts +++ b/src/shared/api/adminTypes.ts @@ -207,20 +207,3 @@ export interface TermsRes { required: boolean; activeAt: string; } - -export type BatchType = "movies" | "tv" | "ott" | "delta"; - -export interface BatchTriggerReq { - type: BatchType; - date?: string; - mediaType?: MediaType; - startDate?: string; - endDate?: string; -} - -export interface BatchJobExecutionRes { - jobName: string; - executionId: number; - status: string; - createTime: string; -} diff --git a/tests/e2e/admin-routes.spec.ts b/tests/e2e/admin-routes.spec.ts index 6b106ac..1a01199 100644 --- a/tests/e2e/admin-routes.spec.ts +++ b/tests/e2e/admin-routes.spec.ts @@ -35,8 +35,6 @@ test("renders main admin routes", async ({ page }) => { await expect(page.getByRole("heading", { name: "컬렉션" })).toBeVisible(); await page.goto("/admin/terms"); await expect(page.getByRole("heading", { name: "약관 관리" })).toBeVisible(); - await page.goto("/admin/batch"); - await expect(page.getByRole("heading", { name: "데이터 업데이트" })).toBeVisible(); }); test("opens moderation detail and resolves a report", async ({ page }) => { @@ -60,7 +58,7 @@ test("opens moderation detail and resolves a report", async ({ page }) => { await expect.poll(() => resolutionRequested).toBe(true); }); -test("submits content, terms, and batch mutations", async ({ page }) => { +test("submits content and terms mutations", async ({ page }) => { await mockAdminApi(page); await seedAdminSession(page); @@ -87,10 +85,6 @@ test("submits content, terms, and batch mutations", async ({ page }) => { await page.getByLabel("적용 시작 시각").press("Enter"); await page.getByRole("button", { name: "약관 생성" }).click(); await expect(page.getByText("약관 번호")).toBeVisible(); - - await page.goto("/admin/batch"); - await page.getByRole("button", { name: "업데이트 시작" }).click(); - await expect(page.getByRole("cell", { name: "영화 정보 가져오기" })).toBeVisible(); }); async function seedAdminSession(page: Page) { @@ -232,20 +226,6 @@ async function mockAdminApi(page: Page, options: { onResolution?: () => void } = return; } - if (method === "POST" && pathname.includes("/admin/batch/")) { - await route.fulfill({ - status: 200, - contentType: "application/json", - body: JSON.stringify({ - jobName: "tmdbMovieImportJob", - executionId: 1, - status: "STARTED", - createTime: "2026-05-17T10:00:00" - }) - }); - return; - } - await route.fulfill({ status: 404, body: "Not mocked" }); }); }