From 7c42e885930520504aacc626ef0ce2ccb804e778 Mon Sep 17 00:00:00 2001 From: dohyeons Date: Thu, 27 Nov 2025 17:11:30 +0900 Subject: [PATCH] =?UTF-8?q?=EC=99=B8=EB=B6=80=20REST=20API=20=EC=BB=A4?= =?UTF-8?q?=EB=84=A5=EC=85=98=EC=97=90=20DB=20=ED=86=A0=ED=81=B0=20?= =?UTF-8?q?=EB=B0=8F=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20UX=20=EA=B0=9C?= =?UTF-8?q?=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../externalRestApiConnectionService.ts | 27 +++++++++++++++++-- .../admin/RestApiConnectionList.tsx | 16 +++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/backend-node/src/services/externalRestApiConnectionService.ts b/backend-node/src/services/externalRestApiConnectionService.ts index a3d79ac3..cee16dc0 100644 --- a/backend-node/src/services/externalRestApiConnectionService.ts +++ b/backend-node/src/services/externalRestApiConnectionService.ts @@ -731,11 +731,34 @@ export class ExternalRestApiConnectionService { return result; } catch (error) { logger.error("REST API 연결 테스트 (ID) 오류:", error); + + const errorMessage = + error instanceof Error ? error.message : "알 수 없는 오류"; + + // 예외가 발생한 경우에도 마지막 테스트 결과를 실패로 기록 + try { + await pool.query( + ` + UPDATE external_rest_api_connections + SET + last_test_date = NOW(), + last_test_result = $1, + last_test_message = $2 + WHERE id = $3 + `, + ["N", errorMessage, id] + ); + } catch (updateError) { + logger.error( + "REST API 연결 테스트 (ID) 오류 기록 실패:", + updateError + ); + } + return { success: false, message: "연결 테스트에 실패했습니다.", - error_details: - error instanceof Error ? error.message : "알 수 없는 오류", + error_details: errorMessage, }; } } diff --git a/frontend/components/admin/RestApiConnectionList.tsx b/frontend/components/admin/RestApiConnectionList.tsx index 0ba0d2b5..11f3d4e3 100644 --- a/frontend/components/admin/RestApiConnectionList.tsx +++ b/frontend/components/admin/RestApiConnectionList.tsx @@ -158,6 +158,22 @@ export function RestApiConnectionList() { setTestResults((prev) => new Map(prev).set(connection.id!, result.success)); + // 현재 행의 "마지막 테스트" 정보만 낙관적으로 업데이트하여 + // 전체 목록 리로딩 없이도 UI를 즉시 반영한다. + const nowIso = new Date().toISOString(); + setConnections((prev) => + prev.map((c) => + c.id === connection.id + ? { + ...c, + last_test_date: nowIso as any, + last_test_result: result.success ? "Y" : "N", + last_test_message: result.message, + } + : c + ) + ); + if (result.success) { toast({ title: "연결 성공",