From aee4e86036794df63f6cb0c50bb974d5602164d2 Mon Sep 17 00:00:00 2001 From: SeongHyun Kim Date: Mon, 17 Nov 2025 16:18:38 +0900 Subject: [PATCH] =?UTF-8?q?entity-search-input=20tableName=20=EC=9C=A0?= =?UTF-8?q?=ED=9A=A8=EC=84=B1=20=EA=B2=80=EC=A6=9D=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B0=8F=20=EC=97=90=EB=9F=AC=20=EB=A9=94=EC=8B=9C=EC=A7=80=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend-node/src/controllers/entitySearchController.ts | 9 +++++++++ .../components/entity-search-input/useEntitySearch.ts | 10 +++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/backend-node/src/controllers/entitySearchController.ts b/backend-node/src/controllers/entitySearchController.ts index 2b944e2b..5046d8bb 100644 --- a/backend-node/src/controllers/entitySearchController.ts +++ b/backend-node/src/controllers/entitySearchController.ts @@ -17,6 +17,15 @@ export async function searchEntity(req: Request, res: Response) { limit = "20", } = req.query; + // tableName 유효성 검증 + if (!tableName || tableName === "undefined" || tableName === "null") { + logger.warn("엔티티 검색 실패: 테이블명이 없음", { tableName }); + return res.status(400).json({ + success: false, + message: "테이블명이 지정되지 않았습니다. 컴포넌트 설정에서 sourceTable을 확인해주세요.", + }); + } + // 멀티테넌시 const companyCode = req.user!.companyCode; diff --git a/frontend/lib/registry/components/entity-search-input/useEntitySearch.ts b/frontend/lib/registry/components/entity-search-input/useEntitySearch.ts index 04428a55..1fac26d6 100644 --- a/frontend/lib/registry/components/entity-search-input/useEntitySearch.ts +++ b/frontend/lib/registry/components/entity-search-input/useEntitySearch.ts @@ -34,6 +34,13 @@ export function useEntitySearch({ const search = useCallback( async (text: string, page: number = 1) => { + // tableName 유효성 검증 + if (!tableName || tableName === "undefined" || tableName === "null") { + console.warn("엔티티 검색 건너뜀: tableName이 없음", { tableName }); + setError("테이블명이 설정되지 않았습니다. 컴포넌트 설정을 확인해주세요."); + return; + } + try { setLoading(true); setError(null); @@ -60,7 +67,8 @@ export function useEntitySearch({ } } catch (err: any) { console.error("Entity search error:", err); - setError(err.response?.data?.message || "검색 중 오류가 발생했습니다"); + const errorMessage = err.response?.data?.message || "검색 중 오류가 발생했습니다"; + setError(errorMessage); } finally { setLoading(false); }