From 7d6f49987a1845e9ff0c2aef4eb51e7729fa12c5 Mon Sep 17 00:00:00 2001 From: bicochan Date: Tue, 15 Jul 2025 12:14:41 +0900 Subject: [PATCH 01/10] =?UTF-8?q?[apps/cs,=20common/features]=20chore:=20F?= =?UTF-8?q?AQ=20=ED=8E=98=EC=9D=B4=EC=A7=80=20PostPageGuard=EB=A1=9C=20?= =?UTF-8?q?=EB=9E=98=ED=95=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/(post)/faq/ui/faq-page.tsx | 270 +++++++++--------- apps/cs/src/pages/(post)/faq/ui/faq-page.tsx | 269 ++++++++--------- 2 files changed, 274 insertions(+), 265 deletions(-) diff --git a/apps/common/features/src/pages/(post)/faq/ui/faq-page.tsx b/apps/common/features/src/pages/(post)/faq/ui/faq-page.tsx index aa67a17c5..6255bb27a 100644 --- a/apps/common/features/src/pages/(post)/faq/ui/faq-page.tsx +++ b/apps/common/features/src/pages/(post)/faq/ui/faq-page.tsx @@ -20,7 +20,7 @@ import { Skeleton, } from "@common/components"; import { AttachmentApi } from "@/entities/attachment"; -import { PostApi, type PostParams } from "@/entities/post"; +import { PostApi, PostPageGuard, type PostParams } from "@/entities/post"; import { useAlertStore, useMenuStore, useUserStore } from "@/shared/lib"; import { ENDPOINT } from "@/shared/config"; import dayjs from "dayjs"; @@ -103,143 +103,147 @@ function FaqPage({ bbsId }: { bbsId: string }) { }; return ( -
-
-
- - - - setPostParams({ ...postParams, keyword: e.target.value }) - } - className="h-[3.2rem] w-[24rem] rounded-sm !text-[1.3rem]" - /> - -
-
-
-
-
-

콘텐츠 목록

-
- {pageMenuAuthority?.regAuthrtYn === "Y" && ( - - )} - {pageMenuAuthority?.delAuthrtYn === "Y" && ( - - )} + +
+
+
+ + + + setPostParams({ ...postParams, keyword: e.target.value }) + } + className="h-[3.2rem] w-[24rem] rounded-sm !text-[1.3rem]" + /> + +
+
+
+
+
+

콘텐츠 목록

+
+ {pageMenuAuthority?.regAuthrtYn === "Y" && ( + + )} + {pageMenuAuthority?.delAuthrtYn === "Y" && ( + + )} +
-
-
-
- e.stopPropagation()} - onCheckedChange={handleAllCheckboxChange} - /> - +
+
+ e.stopPropagation()} + onCheckedChange={handleAllCheckboxChange} + /> + +
+ {isFetched ? ( + + {postList?.content.map((item) => ( +
+ e.stopPropagation()} + onCheckedChange={(checked) => + handleCheckboxChange(item.pstNo, checked) + } + className="mx-2 my-6" + /> + + +
+
+ Q + {item.pstTtl} +
+ + 등록일: {dayjs(item.regDt).format("YYYY-MM-DD")} + +
+
+ +
+ + A + +
+
+                              {item.pstCn}
+                            
+ +
+
+ + +
+
+
+
+
+ ))} +
+ ) : ( + + )}
- {isFetched ? ( - - {postList?.content.map((item) => ( -
- e.stopPropagation()} - onCheckedChange={(checked) => - handleCheckboxChange(item.pstNo, checked) - } - className="mx-2 my-6" - /> - - -
-
- Q - {item.pstTtl} -
- - 등록일: {dayjs(item.regDt).format("YYYY-MM-DD")} - -
-
- -
- - A - -
-
-                            {item.pstCn}
-                          
- -
-
- - -
-
-
-
-
- ))} -
- ) : ( - - )}
-
+
); } diff --git a/apps/cs/src/pages/(post)/faq/ui/faq-page.tsx b/apps/cs/src/pages/(post)/faq/ui/faq-page.tsx index 8ddd3006a..f23a70663 100644 --- a/apps/cs/src/pages/(post)/faq/ui/faq-page.tsx +++ b/apps/cs/src/pages/(post)/faq/ui/faq-page.tsx @@ -23,6 +23,7 @@ import { import { AttachmentApi } from "@/entities/attachment"; import { PostApi, + PostPageGuard, deleteReasonMessages, type PostParams, } from "@/entities/post"; @@ -120,143 +121,147 @@ function FaqPage({ bbsId }: { bbsId: string }) { }; return ( -
-
-
- - - - setPostParams({ ...postParams, keyword: e.target.value }) - } - className="h-[3.2rem] w-[24rem] rounded-sm !text-[1.3rem]" - /> - -
-
-
-
-
-

콘텐츠 목록

-
- router.push(`${pathname}/register`)} - > - 등록 - - - 선택삭제 - + +
+
+
+ + + + setPostParams({ ...postParams, keyword: e.target.value }) + } + className="h-[3.2rem] w-[24rem] rounded-sm !text-[1.3rem]" + /> + +
+
+
+
+
+

콘텐츠 목록

+
+ router.push(`${pathname}/register`)} + > + 등록 + + + 선택삭제 + +
-
-
-
- e.stopPropagation()} - onCheckedChange={handleAllCheckboxChange} - /> - +
+
+ e.stopPropagation()} + onCheckedChange={handleAllCheckboxChange} + /> + +
+ {isFetched ? ( + + {postList?.content.map((item) => ( +
+ e.stopPropagation()} + onCheckedChange={(checked) => + handleCheckboxChange(item.pstNo, checked) + } + className="mx-2 my-6" + /> + + +
+
+ Q + {item.pstTtl} +
+ + 등록일: {dayjs(item.regDt).format("YYYY-MM-DD")} + +
+
+ +
+ + A + +
+
+                              {item.pstCn}
+                            
+ +
+
+ + +
+
+
+
+
+ ))} +
+ ) : ( + + )}
- {isFetched ? ( - - {postList?.content.map((item) => ( -
- e.stopPropagation()} - onCheckedChange={(checked) => - handleCheckboxChange(item.pstNo, checked) - } - className="mx-2 my-6" - /> - - -
-
- Q - {item.pstTtl} -
- - 등록일: {dayjs(item.regDt).format("YYYY-MM-DD")} - -
-
- -
- - A - -
-
-                            {item.pstCn}
-                          
- -
-
- - -
-
-
-
-
- ))} -
- ) : ( - - )}
-
+
); } From 61f261a25b4f929a30c19072d5399f3800348a0d Mon Sep 17 00:00:00 2001 From: bicochan Date: Tue, 15 Jul 2025 12:16:03 +0900 Subject: [PATCH 02/10] =?UTF-8?q?[apps/cs]=20chore:=20=EC=83=9D=EC=84=B1?= =?UTF-8?q?=20=EB=B0=8F=20=EC=88=98=EC=A0=95=20=ED=9B=84=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=EC=9C=BC=EB=A1=9C=20=EC=9D=B4=EB=8F=99=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20(CS=5FUT03020103)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/cs/src/pages/contents/ui/modify-page.tsx | 20 ++++++++++++------- apps/cs/src/pages/file/ui/file-page.tsx | 3 +-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/apps/cs/src/pages/contents/ui/modify-page.tsx b/apps/cs/src/pages/contents/ui/modify-page.tsx index e783e9c1c..c6347ea59 100644 --- a/apps/cs/src/pages/contents/ui/modify-page.tsx +++ b/apps/cs/src/pages/contents/ui/modify-page.tsx @@ -1,5 +1,6 @@ "use client"; +import { useRouter } from "next/navigation"; import { useEffect, useState } from "react"; import { useQuery, useQueryClient } from "@tanstack/react-query"; import { useConfirm } from "@frontend-opensource/use-react-hooks"; @@ -24,6 +25,7 @@ import { useAlertStore, useMutationWrapper } from "@/shared/lib"; import { ContentsForm } from "./contents-form"; function ModifyPage({ sequential }: { sequential: string }) { + const router = useRouter(); const { confirm } = useConfirm(); const queryClient = useQueryClient(); const alert = useAlertStore((state) => state.setMessage); @@ -51,9 +53,11 @@ function ModifyPage({ sequential }: { sequential: string }) { mutationFn: (data: ContentsFormData) => ContentsApi.createContents(data), onSuccess: () => { setContsVer(0); - alert("수정되었습니다."); - queryClient.invalidateQueries({ - queryKey: [ENDPOINT.CMS_SERVICE.CONTENTS_DETAILS, contsSn], + alert("수정되었습니다.", () => { + queryClient.invalidateQueries({ + queryKey: [ENDPOINT.CMS_SERVICE.CONTENTS_DETAILS, contsSn], + }); + router.back(); }); }, }); @@ -62,7 +66,7 @@ function ModifyPage({ sequential }: { sequential: string }) { mutationFn: (data: ContentsFormData) => ContentsApi.updateContents(contsSn, contsVer, data), onSuccess: () => { - alert("수정되었습니다."); + alert("수정되었습니다.", router.back); }, }); @@ -70,9 +74,11 @@ function ModifyPage({ sequential }: { sequential: string }) { mutationFn: () => ContentsApi.deleteContents(contsSn, contsVer), onSuccess: () => { setContsVer(0); - alert("삭제되었습니다."); - queryClient.invalidateQueries({ - queryKey: [ENDPOINT.CMS_SERVICE.CONTENTS_DETAILS, contsSn], + alert("삭제되었습니다.", () => { + queryClient.invalidateQueries({ + queryKey: [ENDPOINT.CMS_SERVICE.CONTENTS_DETAILS, contsSn], + }); + router.back(); }); }, }); diff --git a/apps/cs/src/pages/file/ui/file-page.tsx b/apps/cs/src/pages/file/ui/file-page.tsx index 8243d47d1..8b5eba617 100644 --- a/apps/cs/src/pages/file/ui/file-page.tsx +++ b/apps/cs/src/pages/file/ui/file-page.tsx @@ -39,8 +39,7 @@ function FilePage() { mutationFn: (atflId: string) => AttachmentApi.deleteAttachmentByAtflId(atflId), onSuccess: () => { - query.refetch(); - alert("삭제되었습니다."); + alert("삭제되었습니다.", query.refetch); }, }); From 586efe940f7194a7ec5a0a2b0149d8062c25fc17 Mon Sep 17 00:00:00 2001 From: bicochan Date: Tue, 15 Jul 2025 13:38:36 +0900 Subject: [PATCH 03/10] =?UTF-8?q?[apps/cs]=20feat:=20=EC=A1=B0=EC=A7=81?= =?UTF-8?q?=EB=8F=84=EA=B4=80=EB=A6=AC=20>=20=EC=82=AC=EC=9A=A9=EC=9E=90?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?(CS=5FUT03040105)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/organization/ui/add-user-dialog.tsx | 2 +- .../ui/user-organization-section.tsx | 33 +++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/apps/cs/src/pages/organization/ui/add-user-dialog.tsx b/apps/cs/src/pages/organization/ui/add-user-dialog.tsx index e0007abfc..737688e49 100644 --- a/apps/cs/src/pages/organization/ui/add-user-dialog.tsx +++ b/apps/cs/src/pages/organization/ui/add-user-dialog.tsx @@ -72,7 +72,7 @@ function AddUserDialog({ onAddUsers, ...props }: AddUserDialogProps) { - 콘텐츠 조회 + 사용자 조회
diff --git a/apps/cs/src/pages/organization/ui/user-organization-section.tsx b/apps/cs/src/pages/organization/ui/user-organization-section.tsx index 6b8e3b789..99e9ac342 100644 --- a/apps/cs/src/pages/organization/ui/user-organization-section.tsx +++ b/apps/cs/src/pages/organization/ui/user-organization-section.tsx @@ -242,6 +242,16 @@ function UserOrganizationSection({ ognzSn }: UserOrganizationSectionProps) {
+ + + + + + + + + + @@ -300,6 +310,9 @@ const UserCells = memo( jobPositionCodeData, jobGradeCodeData, }: UserCellsProps) => { + const [jbpsSeCd, setJbpsSeCd] = useState(user.jbpsSeCd); + const [jbgdSeCd, setJbgdSeCd] = useState(user.jbgdSeCd); + const updateMode = (index: number) => { const mode = form.watch(`userOrganization.${index}.mode`); if (mode === "R") { @@ -322,17 +335,33 @@ const UserCells = memo( { + setJbpsSeCd(value); + updateFormValue(index, "jbpsSeCd")(value); + }} {...form.register(`userOrganization.${index}.jbpsSeCd`)} /> + {!jbpsSeCd && ( +

+ 직위를 선택해주세요. +

+ )} { + setJbgdSeCd(value); + updateFormValue(index, "jbgdSeCd")(value); + }} {...form.register(`userOrganization.${index}.jbgdSeCd`)} /> + {!jbgdSeCd && ( +

+ 직급을 선택해주세요. +

+ )}
Date: Tue, 15 Jul 2025 13:50:47 +0900 Subject: [PATCH 04/10] =?UTF-8?q?[apps/cs]=20chore:=20=EA=B4=80=EB=A6=AC?= =?UTF-8?q?=EC=9E=90=EA=B4=80=EB=A6=AC=20>=20=EA=B4=80=EB=A6=AC=EC=9E=90?= =?UTF-8?q?=20=EB=AA=A9=EB=A1=9D=20=EC=A1=B0=ED=9A=8C=20=EA=B8=B0=EB=B3=B8?= =?UTF-8?q?=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?(CS=5FUT04010101)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/cs/src/pages/admin/ui/admin-page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/cs/src/pages/admin/ui/admin-page.tsx b/apps/cs/src/pages/admin/ui/admin-page.tsx index 95d2c4e91..c2d3aa5af 100644 --- a/apps/cs/src/pages/admin/ui/admin-page.tsx +++ b/apps/cs/src/pages/admin/ui/admin-page.tsx @@ -38,7 +38,7 @@ function AdminPage() { const alert = useAlertStore((state) => state.setMessage); const { confirm } = useConfirm(); - const [keywordType, setKeywordType] = useState(""); + const [keywordType, setKeywordType] = useState("userId"); const [keyword, setKeyword] = useState(""); const [grpId, setGrpId] = useState(""); const [searchParams, setSearchParams] = useState({ From 9e5c30be8ac6f9625ed63113c7c73c340caeeb1b Mon Sep 17 00:00:00 2001 From: bicochan Date: Tue, 15 Jul 2025 15:21:07 +0900 Subject: [PATCH 05/10] =?UTF-8?q?[apps/cs]=20feat:=20=EA=B6=8C=ED=95=9C?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20=EB=AA=A9=EB=A1=9D=20=EB=82=B4=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80=20(CS=5FUT0?= =?UTF-8?q?4010104)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cs/src/pages/role/model/table-columns.tsx | 20 +++++++++++++++++-- apps/cs/src/pages/role/ui/role-page.tsx | 16 ++++++++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/apps/cs/src/pages/role/model/table-columns.tsx b/apps/cs/src/pages/role/model/table-columns.tsx index f1e586043..71da16cfe 100644 --- a/apps/cs/src/pages/role/model/table-columns.tsx +++ b/apps/cs/src/pages/role/model/table-columns.tsx @@ -3,8 +3,13 @@ import { useState } from "react"; import type { Role } from "@/entities/role"; import type { ColumnDef } from "@tanstack/react-table"; import { MappingRoleDialog } from "../ui/mapping-role-dialog"; +import { Button } from "@common/components"; -export const columns: ColumnDef[] = [ +export const createColumns = ({ + deleteRole, +}: { + deleteRole: (roleId: string) => void; +}): ColumnDef[] => [ { id: "no", header: "NO", @@ -39,7 +44,18 @@ export const columns: ColumnDef[] = [ { id: "action", header: "관리", - cell: ({ row }) => , + cell: ({ row }) => ( +
+ + +
+ ), }, ]; diff --git a/apps/cs/src/pages/role/ui/role-page.tsx b/apps/cs/src/pages/role/ui/role-page.tsx index 7d5453895..97c3d615b 100644 --- a/apps/cs/src/pages/role/ui/role-page.tsx +++ b/apps/cs/src/pages/role/ui/role-page.tsx @@ -7,11 +7,12 @@ import { getCoreRowModel, type PaginationState } from "@tanstack/react-table"; import { Button, Input, Label } from "@common/components"; import { RoleApi, type Role, type RoleParams } from "@/entities/role"; import { ENDPOINT } from "@/shared/config"; -import { useDataTable } from "@/shared/lib"; -import { columns } from "../model/table-columns"; +import { useAlertStore, useDataTable, useMutationWrapper } from "@/shared/lib"; +import { createColumns } from "../model/table-columns"; function RolePage() { const router = useRouter(); + const alert = useAlertStore((state) => state.setMessage); const [keyword, setKeyword] = useState(""); const [searchParams, setSearchParams] = useState({ @@ -33,6 +34,13 @@ function RolePage() { }), }); + const { mutateAsync: deleteRole } = useMutationWrapper({ + mutationFn: (roleId: string) => RoleApi.deleteRole(roleId), + onSuccess: () => { + alert("삭제되었습니다.", query.refetch); + }, + }); + const handleRowClick = (row: Role) => { router.push(`/role/register/${row.roleId}`); }; @@ -40,7 +48,9 @@ function RolePage() { const { tableComponent } = useDataTable({ query, tableOptions: { - columns, + columns: createColumns({ + deleteRole, + }), state: { pagination, }, From 21aab85ff8cb9f43c9b830c76e38104e644a1432 Mon Sep 17 00:00:00 2001 From: bicochan Date: Tue, 15 Jul 2025 23:01:56 +0900 Subject: [PATCH 06/10] =?UTF-8?q?[apps/cs]=20feat:=20=EB=AF=B8=EB=93=A4?= =?UTF-8?q?=EC=9B=A8=EC=96=B4=20=EB=A1=9C=EA=B9=85=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/cs/middleware.ts | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/apps/cs/middleware.ts b/apps/cs/middleware.ts index 61d38c071..79d2c8f65 100644 --- a/apps/cs/middleware.ts +++ b/apps/cs/middleware.ts @@ -1,5 +1,12 @@ import { NextRequest, NextResponse } from "next/server"; -import { CLAIM_NAME, AUTH_USER_ID } from "./src/shared/config"; +import { + CLAIM_NAME, + AUTH_USER_ID, + PORT, + PROXY_HOST, + SERVER_API_URL, + SITE_ID, +} from "./src/shared/config"; const serverApiUrl = process.env.NEXT_PUBLIC_SERVER_API_URL ?? "http://localhost:3000"; @@ -7,17 +14,23 @@ const serverApiUrl = export function middleware(req: NextRequest) { const pathname = req.nextUrl.pathname; const searchParams = req.nextUrl.searchParams; - + + const logMessages: string[] = [ + `[Middleware Request] ${new Date().toISOString()}`, + `[Environment]\n Mode: ${process.env.NODE_ENV}\n Port: ${PORT}\n Proxy Host: ${PROXY_HOST}\n Server API URL: ${SERVER_API_URL}\n Site ID: ${SITE_ID}`, + `[Request]\n Original Pathname: ${pathname}`, + ]; if (pathname.startsWith("/server")) { - - const decodedParams = Array.from(searchParams.entries()) - .map(([key, value]) => `${key}=${decodeURIComponent(value)}`) - .join("&"); - + const queryParams = searchParams.toString(); const newUrl = `${serverApiUrl}${pathname.replace("/server", "")}${ - decodedParams ? `?${decodedParams}` : "" + queryParams ? `?${queryParams}` : "" }`; + + logMessages.push(` Rewritten URL: ${newUrl}`); + logMessages.push("\n--------------------------------\n"); + console.log(logMessages.join("\n")); + return NextResponse.rewrite(new URL(newUrl)); } @@ -30,6 +43,10 @@ export function middleware(req: NextRequest) { if (token) requestHeaders.set(CLAIM_NAME, token); if (userId) requestHeaders.set(AUTH_USER_ID, userId); + logMessages.push(` Rewritten URL: ${newUrl}`); + logMessages.push("\n--------------------------------\n"); + console.log(logMessages.join("\n")); + return NextResponse.rewrite(new URL(newUrl), { headers: requestHeaders, }); @@ -39,6 +56,8 @@ export function middleware(req: NextRequest) { return NextResponse.redirect(new URL("/dashboard", req.url)); } + logMessages.push("\n--------------------------------\n"); + console.log(logMessages.join("\n")); return NextResponse.next(); } From fad4a14a82493a71160e9ac4e35d0117df4d4b62 Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 16 Jul 2025 09:53:24 +0900 Subject: [PATCH 07/10] =?UTF-8?q?[apps/cs]=20fix:=20=EC=BD=98=ED=85=90?= =?UTF-8?q?=EC=B8=A0=20=EB=93=B1=EB=A1=9D=20=ED=8F=BC=20=EB=B2=84=EA=B7=B8?= =?UTF-8?q?=20=EC=88=98=EC=A0=95=20(CS=5FUT03020102)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/model/contents-interface.ts | 21 ++++++++++++++----- apps/cs/src/pages/contents/ui/create-page.tsx | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/apps/cs/src/entities/content/model/contents-interface.ts b/apps/cs/src/entities/content/model/contents-interface.ts index 7709eea08..54e42729a 100644 --- a/apps/cs/src/entities/content/model/contents-interface.ts +++ b/apps/cs/src/entities/content/model/contents-interface.ts @@ -67,11 +67,22 @@ export const contentsDetailSchema = z.object({ useYn: z.string(), }); -export const contentsFormSchema = contentsDetailSchema.omit({ - contsVer: true, - aprvDt: true, - autzr: true, -}); +export const contentsFormSchema = contentsDetailSchema + .omit({ + contsVer: true, + aprvDt: true, + autzr: true, + }) + .extend({ + contsSn: z.number().optional(), + aprvCd: z + .enum([ + CONTENTS_APPROVE_STATUS.DRAFT, + CONTENTS_APPROVE_STATUS.REQUESTED, + CONTENTS_APPROVE_STATUS.APPROVED, + ]) + .optional(), + }); export type Contents = z.infer; export type ContentsDetail = z.infer; diff --git a/apps/cs/src/pages/contents/ui/create-page.tsx b/apps/cs/src/pages/contents/ui/create-page.tsx index dfbb2a9fb..6868d6937 100644 --- a/apps/cs/src/pages/contents/ui/create-page.tsx +++ b/apps/cs/src/pages/contents/ui/create-page.tsx @@ -34,7 +34,7 @@ function CreatePage() {

콘텐츠 등록

- + ); } From 0a3a84bb98e5b7575ac4834b8a2aeae9c0c8b58d Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 16 Jul 2025 12:08:18 +0900 Subject: [PATCH 08/10] =?UTF-8?q?[apps/cs]=20feat:=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EC=83=81=ED=83=9C=20=EB=B1=83=EC=A7=80=EB=A1=9C=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C=20(CS=5FUT05010109)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/cs/src/entities/user/index.ts | 1 + .../src/entities/user/model/user-interface.ts | 3 ++- .../src/pages/users/model/table-columns.tsx | 27 +++++++++++++++++-- apps/cs/src/pages/users/ui/create-page.tsx | 9 ------- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/apps/cs/src/entities/user/index.ts b/apps/cs/src/entities/user/index.ts index 7b4615e01..8927256f9 100644 --- a/apps/cs/src/entities/user/index.ts +++ b/apps/cs/src/entities/user/index.ts @@ -4,6 +4,7 @@ export { userSaveSchema, userPasswordUpdateSchema, userUpdateSchema, + type UserStateCode, type UserSearchParams, type UserListResponse, type UserSaveData, diff --git a/apps/cs/src/entities/user/model/user-interface.ts b/apps/cs/src/entities/user/model/user-interface.ts index 69320e8c7..012fe9e92 100644 --- a/apps/cs/src/entities/user/model/user-interface.ts +++ b/apps/cs/src/entities/user/model/user-interface.ts @@ -9,7 +9,8 @@ export const USER_STATE_CODE = { 삭제: "09", } as const; -type UserStateCode = (typeof USER_STATE_CODE)[keyof typeof USER_STATE_CODE]; +export type UserStateCode = + (typeof USER_STATE_CODE)[keyof typeof USER_STATE_CODE]; // 사용자 검색 파라미터 export interface UserSearchParams extends PageableParams { diff --git a/apps/cs/src/pages/users/model/table-columns.tsx b/apps/cs/src/pages/users/model/table-columns.tsx index 0b61b0569..1aad6de27 100644 --- a/apps/cs/src/pages/users/model/table-columns.tsx +++ b/apps/cs/src/pages/users/model/table-columns.tsx @@ -1,6 +1,11 @@ import dayjs from "dayjs"; import type { ColumnDef } from "@tanstack/react-table"; -import type { UserListResponse } from "@/entities/user"; +import { + USER_STATE_CODE, + type UserListResponse, + type UserStateCode, +} from "@/entities/user"; +import { Badge } from "@common/components"; export const columns: ColumnDef[] = [ { @@ -42,8 +47,11 @@ export const columns: ColumnDef[] = [ header: "기관/부서", }, { - accessorKey: "userStateCodeName", + accessorKey: "userStateCode", header: "회원상태", + cell: ({ row }) => { + return getUserStateBadge(row.original.userStateCode); + }, }, { accessorKey: "aprvYmd", @@ -63,3 +71,18 @@ export const columns: ColumnDef[] = [ }, }, ]; + +const getUserStateBadge = (userStateCode: UserStateCode) => { + switch (userStateCode) { + case USER_STATE_CODE.대기: + return 대기; + case USER_STATE_CODE.정상: + return 정상; + case USER_STATE_CODE.정지: + return 정지; + case USER_STATE_CODE.탈퇴: + return 탈퇴; + case USER_STATE_CODE.삭제: + return 삭제; + } +}; diff --git a/apps/cs/src/pages/users/ui/create-page.tsx b/apps/cs/src/pages/users/ui/create-page.tsx index f58469327..2d55a1cd2 100644 --- a/apps/cs/src/pages/users/ui/create-page.tsx +++ b/apps/cs/src/pages/users/ui/create-page.tsx @@ -16,20 +16,11 @@ function CreatePage() { defaultValues: { userId: "", userName: "", - email: "", password: "", pswdHnt: "", - pswdAns: "", - mphn: "", - telno: "", - zip: "", - addr: "", - daddr: "", laeSeCd: "", ogdpSeCd: "", expryYmd: "", - instSeCd: "", - enoCd: "", }, }); From dd5af43d339d27b1d208b7efbf47d26d13b7cb64 Mon Sep 17 00:00:00 2001 From: bicochan Date: Wed, 16 Jul 2025 13:30:41 +0900 Subject: [PATCH 09/10] =?UTF-8?q?[apps/cs]=20chore:=20=EA=B7=B8=EB=A3=B9?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=20=EB=82=B4=20=EC=82=AC=EC=9A=A9=EC=9E=90=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=ED=8C=9D=EC=97=85=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?(CS=5FUT05020103)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/groups/ui/add-user-dialog.tsx | 76 ++++++++++++++----- 1 file changed, 56 insertions(+), 20 deletions(-) diff --git a/apps/cs/src/pages/groups/ui/add-user-dialog.tsx b/apps/cs/src/pages/groups/ui/add-user-dialog.tsx index aafba70db..4f8a205ff 100644 --- a/apps/cs/src/pages/groups/ui/add-user-dialog.tsx +++ b/apps/cs/src/pages/groups/ui/add-user-dialog.tsx @@ -1,6 +1,6 @@ "use client"; -import { useState } from "react"; +import { useState, useEffect } from "react"; import { keepPreviousData, useQuery, @@ -22,6 +22,7 @@ import { DialogFooter, Input, Checkbox, + Label, } from "@common/components"; import { UserApi, @@ -41,7 +42,8 @@ function AddUserDialog({ groupId }: AdditionalUserDialogProps) { const alert = useAlertStore((state) => state.setMessage); const [open, setOpen] = useState(false); - const [userSearchQuery, setUserSearchQuery] = useState({ + const [userName, setUserName] = useState(""); + const [searchParam, setSearchParam] = useState({ userName: "", }); const [pagination, setPagination] = useState({ @@ -53,10 +55,10 @@ function AddUserDialog({ groupId }: AdditionalUserDialogProps) { ); const query = useQuery({ - queryKey: [ENDPOINT.USER_SERVICE.USERS, userSearchQuery, pagination], + queryKey: [ENDPOINT.USER_SERVICE.USERS, searchParam, pagination], queryFn: () => UserApi.findPageUser({ - ...userSearchQuery, + ...searchParam, page: pagination.pageIndex, size: pagination.pageSize, }), @@ -118,6 +120,9 @@ function AddUserDialog({ groupId }: AdditionalUserDialogProps) { onRowSelectionChange: setUserRowSelection, getRowId: (row) => row.userUnqId, }, + dataTableOptions: { + viewPagination: true, + }, }); const handleAddUsers = async () => { @@ -144,10 +149,30 @@ function AddUserDialog({ groupId }: AdditionalUserDialogProps) { } }; - const handleSearch = () => { - setPagination({ pageIndex: 0, pageSize: 10 }); + const handleSearch = (e: React.FormEvent) => { + e.preventDefault(); + e.stopPropagation(); + setPagination({ + ...pagination, + pageIndex: 0, + }); + setSearchParam({ userName }); }; + const resetSearch = () => { + setPagination({ + pageIndex: 0, + pageSize: 10, + }); + setUserName(""); + setSearchParam({ userName: "" }); + setUserRowSelection({}); + }; + + useEffect(() => { + if (open) resetSearch(); + }, [open]); + return ( @@ -157,20 +182,31 @@ function AddUserDialog({ groupId }: AdditionalUserDialogProps) { 사용자 추가 -
- - setUserSearchQuery({ - ...userSearchQuery, - userName: e.target.value, - }) - } - className="!text-[1.3rem]" - placeholder="사용자 이름으로 검색" - /> - -
+
+
+ + setUserName(e.target.value)} + placeholder="사용자 이름으로 검색" + /> +
+ + + {tableComponent}