버튼에 제어 달기

This commit is contained in:
kjs
2025-09-29 15:21:14 +09:00
parent e057c4d960
commit 3c26f24179
17 changed files with 291 additions and 71 deletions

View File

@@ -6,11 +6,9 @@
import { Request, Response } from "express";
import { AuthenticatedRequest } from "../types/auth";
import { PrismaClient } from "@prisma/client";
import prisma from "../config/database";
import logger from "../utils/logger";
const prisma = new PrismaClient();
/**
* 데이터 액션 실행
*/
@@ -102,16 +100,34 @@ async function executeExternalDatabaseAction(
connection: any
): Promise<any> {
try {
// TODO: 외부 데이터베이스 연결 및 실행 로직 구현
// 현재는 로그만 출력하고 성공으로 처리
logger.info(`외부 DB 액션 실행: ${connection.name} (${connection.host}:${connection.port})`);
logger.info(`테이블: ${tableName}, 액션: ${actionType}`, data);
// 임시 성공 응답
// 🔥 실제 외부 DB 연결 및 실행 로직 구현
const { MultiConnectionQueryService } = await import('../services/multiConnectionQueryService');
const queryService = new MultiConnectionQueryService();
let result;
switch (actionType.toLowerCase()) {
case 'insert':
result = await queryService.insertDataToConnection(connection.id, tableName, data);
logger.info(`외부 DB INSERT 성공:`, result);
break;
case 'update':
// TODO: UPDATE 로직 구현 (조건 필요)
throw new Error('UPDATE 액션은 아직 지원되지 않습니다. 조건 설정이 필요합니다.');
case 'delete':
// TODO: DELETE 로직 구현 (조건 필요)
throw new Error('DELETE 액션은 아직 지원되지 않습니다. 조건 설정이 필요합니다.');
default:
throw new Error(`지원하지 않는 액션 타입: ${actionType}`);
}
return {
success: true,
message: `외부 DB 액션 실행 완료: ${actionType} on ${tableName}`,
connection: connection.name,
data: result,
affectedRows: 1,
};
} catch (error) {