From d22034a237226c401a3b81b367a6e64fa146b130 Mon Sep 17 00:00:00 2001 From: bicochan Date: Tue, 24 Jun 2025 14:02:41 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=B9=8C=EB=93=9C=20=EC=97=90=EB=9F=AC?= =?UTF-8?q?=20=ED=95=B4=EA=B2=B0(loginlog=20=ED=8F=B4=EB=8D=94=20=EC=9E=84?= =?UTF-8?q?=EC=8B=9C=20=EC=A0=9C=EA=B1=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/(with-base-layout)/loginlog/page.tsx | 2 - .../pages/loginlog/api/loginlog-service.ts | 27 -- apps/cs/src/pages/loginlog/index.ts | 1 - .../loginlog/model/loginlog-interface.ts | 38 --- .../pages/loginlog/model/table-columns.tsx | 64 ---- .../src/pages/loginlog/ui/loginlog-dialog.tsx | 280 ------------------ .../src/pages/loginlog/ui/loginlog-page.tsx | 95 ------ 7 files changed, 507 deletions(-) delete mode 100644 apps/cs/app/(with-base-layout)/loginlog/page.tsx delete mode 100644 apps/cs/src/pages/loginlog/api/loginlog-service.ts delete mode 100644 apps/cs/src/pages/loginlog/index.ts delete mode 100644 apps/cs/src/pages/loginlog/model/loginlog-interface.ts delete mode 100644 apps/cs/src/pages/loginlog/model/table-columns.tsx delete mode 100644 apps/cs/src/pages/loginlog/ui/loginlog-dialog.tsx delete mode 100644 apps/cs/src/pages/loginlog/ui/loginlog-page.tsx diff --git a/apps/cs/app/(with-base-layout)/loginlog/page.tsx b/apps/cs/app/(with-base-layout)/loginlog/page.tsx deleted file mode 100644 index 960f03e05..000000000 --- a/apps/cs/app/(with-base-layout)/loginlog/page.tsx +++ /dev/null @@ -1,2 +0,0 @@ -import { LoginlogPage } from "@/pages/loginlog"; -export default LoginlogPage; diff --git a/apps/cs/src/pages/loginlog/api/loginlog-service.ts b/apps/cs/src/pages/loginlog/api/loginlog-service.ts deleted file mode 100644 index a813ba897..000000000 --- a/apps/cs/src/pages/loginlog/api/loginlog-service.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { client } from "@/shared/api"; -import { ENDPOINT } from "@/shared/config"; -import type { - LoginlogInfo, - LoginlogList, - LoginlogParams, - LoginlogService, -} from "../model/loginlog-interface"; - -export class LoginlogApiService implements LoginlogService { - public async getLoginlogList(params: LoginlogParams): Promise { - const response = await client.get( - `${ENDPOINT.CMS_SERVICE.LOGINLOG}`, - { params }, - ); - return response.data; - } - - public async getLoginlogInfo(lgnSn: string): Promise { - const response = await client.get( - `${ENDPOINT.CMS_SERVICE.LOGINLOG}/${lgnSn}`, - ); - return response.data; - } -} - -export const LoginlogApi = new LoginlogApiService(); diff --git a/apps/cs/src/pages/loginlog/index.ts b/apps/cs/src/pages/loginlog/index.ts deleted file mode 100644 index 4e5e70ea8..000000000 --- a/apps/cs/src/pages/loginlog/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { LoginlogPage } from "./ui/loginlog-page"; diff --git a/apps/cs/src/pages/loginlog/model/loginlog-interface.ts b/apps/cs/src/pages/loginlog/model/loginlog-interface.ts deleted file mode 100644 index 37d6a33b9..000000000 --- a/apps/cs/src/pages/loginlog/model/loginlog-interface.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { z } from "zod"; -import type { PageableList, PageableParams } from "@/shared/model"; - -export interface LoginlogParams extends PageableParams { - lgnSn?: string; - userId?: string; - siteId?: string; -} - -export interface Loginlog { - lgnSn: string; - lgnDt: string; - userId: string; - lgnIp: string; - lgnMethodCd: string; - errOcrnYn: string; - lgnErrCd: string; - siteId: string; -} - -export interface LoginlogInfo { - lgnSn: string; - lgnDt: string; - userId: string; - lgnIp: string; - lgnMethodCd: string; - errOcrnYn: string; - lgnErrCd: string; - siteId: string; -} - -export type LoginlogList = PageableList; - -export interface LoginlogService { - getLoginlogList: (params: LoginlogParams) => Promise; - getLoginlogInfo: (lgnSn: string) => Promise; - -} diff --git a/apps/cs/src/pages/loginlog/model/table-columns.tsx b/apps/cs/src/pages/loginlog/model/table-columns.tsx deleted file mode 100644 index 298ee7d32..000000000 --- a/apps/cs/src/pages/loginlog/model/table-columns.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import dayjs from "dayjs"; -import { useState } from "react"; -import type { ColumnDef } from "@tanstack/react-table"; -import { Button } from "@common/components"; -import type { UpCode } from "@/entities/code"; -import { LoginlogDialog } from "../ui/loginlog-dialog"; - -export const columns: ColumnDef[] = [ - { - id: "no", - header: "NO", - cell: ({ row, table }) => { - const totalRows = table.getRowCount(); - const { pageIndex, pageSize } = table.getState().pagination; - return totalRows - (pageIndex * pageSize + row.index); - }, - }, - { - accessorKey: "upCd", - header: "상위코드", - }, - { - accessorKey: "upCdNm", - header: "상위코드명", - }, - { - accessorKey: "cdSe", - header: "코드구분", - }, - { - accessorKey: "useYn", - header: "사용여부", - }, - { - accessorKey: "regDt", - header: "등록일", - cell: ({ row }) => { - const date = dayjs(row.original.regDt); - return date.format("YYYY-MM-DD"); - }, - }, - { - id: "actions", - header: "관리", - cell: ({ row }) => ( -
e.stopPropagation()}> - -
- ), - }, -]; - -const LoginlogButton = ({ upCd }: { upCd: string }) => { - const [dialogOpen, setDialogOpen] = useState(false); - return ( - - - - ); -}; diff --git a/apps/cs/src/pages/loginlog/ui/loginlog-dialog.tsx b/apps/cs/src/pages/loginlog/ui/loginlog-dialog.tsx deleted file mode 100644 index 55aea3ac2..000000000 --- a/apps/cs/src/pages/loginlog/ui/loginlog-dialog.tsx +++ /dev/null @@ -1,280 +0,0 @@ -import { memo } from "react"; -import { useForm } from "react-hook-form"; -import { zodResolver } from "@hookform/resolvers/zod"; -import { useQuery } from "@tanstack/react-query"; -import { useConfirm } from "@frontend-opensource/use-react-hooks"; -import { - Button, - Dialog, - DialogClose, - DialogContent, - DialogFooter, - DialogHeader, - DialogTitle, - Table, - TableBody, - TableCell, - TableHead, - TableRow, - Input, - RadioGroup, - RadioGroupItem, - Label, - DialogTrigger, -} from "@common/components"; -import { - CodeSelect, - UpCodeApi, - upCodeFormSchema, - type UpCodeFormData, -} from "@/entities/code"; -import { SiteSelect } from "@/entities/site"; -import { ENDPOINT } from "@/shared/config"; -import { useAlertStore, useMutationWrapper } from "@/shared/lib"; -import { Form, FormField, FormItem, FormControl } from "@/shared/ui/form"; - -type LoginlogDialogProps = { - upCd?: string; - children?: React.ReactNode; - open?: boolean; - onOpenChange?: (open: boolean) => void; -}; - -const LoginlogDialog = memo( - ({ - upCd, - children, - open, - onOpenChange, - ...props - }: LoginlogDialogProps) => { - const isRegistration = !upCd; - - const { confirm } = useConfirm(); - const alert = useAlertStore((state) => state.setMessage); - - const { data: detailData } = useQuery({ - queryKey: [ENDPOINT.CMS_SERVICE.UP_CODE, upCd], - queryFn: () => UpCodeApi.upCodeDetail(upCd!), - enabled: open && !!upCd, - }); - - const { mutateAsync: createUpCode } = useMutationWrapper({ - mutationFn: (data: UpCodeFormData) => UpCodeApi.createUpCode(data), - onSuccess: () => { - alert("등록되었습니다.", () => onOpenChange?.(false)); - }, - }); - - const { mutateAsync: updateUpCode } = useMutationWrapper({ - mutationFn: (data: UpCodeFormData) => UpCodeApi.updateUpCode(upCd!, data), - onSuccess: () => { - alert("수정되었습니다.", () => onOpenChange?.(false)); - }, - }); - - const form = useForm({ - resolver: zodResolver(upCodeFormSchema), - values: { - upCd: detailData?.upCd ?? "", - upCdNm: detailData?.upCdNm ?? "", - cdSe: detailData?.cdSe ?? "", - siteId: detailData?.siteId ?? "", - upCdExpln: detailData?.upCdExpln ?? "", - useYn: detailData?.useYn ?? "Y", - delYn: "N", - }, - }); - - const onSubmit = - (callback: (data: UpCodeFormData) => void) => - async (data: UpCodeFormData) => { - const confirmMessage = isRegistration - ? "등록하시겠습니까?" - : "수정하시겠습니까?"; - - if (await confirm(confirmMessage)) callback(data); - }; - - return ( - - {children} - - - - {isRegistration ? "상위코드 등록" : "상위코드 관리"} - - -
- - - - - - - - - 상위코드 - - ( - - - - - - )} - /> - - - - 상위코드명 - - ( - - - - - - )} - /> - - - - 상위코드설명 - - ( - - - - - - )} - /> - - - - 코드구분 - - ( - - - - - - )} - /> - - - - 사이트 - - ( - - - - - - )} - /> - - - - 사용여부 - - ( - - - -
- - -
-
- - -
-
-
-
- )} - /> -
-
-
-
- - - - - - -
- -
-
- ); - }, - (prevProps, nextProps) => { - return ( - prevProps.upCd === nextProps.upCd && prevProps.open === nextProps.open - ); - }, -); - -LoginlogDialog.displayName = "LoginlogDialog"; - -export { LoginlogDialog }; diff --git a/apps/cs/src/pages/loginlog/ui/loginlog-page.tsx b/apps/cs/src/pages/loginlog/ui/loginlog-page.tsx deleted file mode 100644 index 01fcf07fd..000000000 --- a/apps/cs/src/pages/loginlog/ui/loginlog-page.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import { useState } from "react"; -import { keepPreviousData, useQuery } from "@tanstack/react-query"; -import { - getCoreRowModel, - useReactTable, - type PaginationState, -} from "@tanstack/react-table"; -import { Button, DataTable, Input, Label } from "@common/components"; -import { LoginlogApi} from "../api/loginlog-service"; -import { type LoginlogParams} from "../model/loginlog-interface"; - -import { ENDPOINT } from "@/shared/config"; -import { columns } from "../model/table-columns"; -import { LoginlogDialog } from "./loginlog-dialog"; - -type LoginlogPageProps = { - lgnSn?: string; -}; - -function LoginlogPage({ lgnSn }: LoginlogPageProps) { - const [dialogOpen, setDialogOpen] = useState(false); - const [loginlogQuery, setLoginlogQuery] = useState({ - userId: "", - siteId: "", - }); - const [pagination, setPagination] = useState({ - pageIndex: 0, - pageSize: 10, - }); - - const { data: loginlogList, refetch } = useQuery({ - queryKey: [ENDPOINT.CMS_SERVICE.LWPO_CODE, lgnSn, pagination], - queryFn: () => - LoginlogApi.getLoginlogList({ - ...loginlogQuery, - lgnSn, - page: pagination.pageIndex, - size: pagination.pageSize, - }), - enabled: !!lgnSn, - placeholderData: keepPreviousData, - }); - - const table = useReactTable({ - data: loginlogList?.content ?? [], - columns, - rowCount: loginlogList?.totalElements ?? 0, - state: { pagination }, - manualPagination: true, - enableMultiRowSelection: false, - getCoreRowModel: getCoreRowModel(), - onPaginationChange: setPagination, - getRowId: (row) => row.lwpoCd, - }); - - const handleSubmit = (e: React.FormEvent) => { - e.preventDefault(); - refetch(); - }; - - return ( -
-
-
- - - setLoginlogQuery({ - ...loginlogQuery, - userId: e.target.value, - }) - } - /> - -
-
-
-
-

하위코드 목록

-
-
- -
-
-
- ); -} - -export { LoginlogPage };