feat: 배치 관리 시스템 테스트 및 업데이트 기능 개선

- 배치 스케줄러 서비스 안정성 향상
- 외부 DB 연결 서비스 개선
- 배치 컨트롤러 및 관리 컨트롤러 업데이트
- 프론트엔드 배치 관리 페이지 개선
- Prisma 스키마 업데이트
This commit is contained in:
2025-09-29 13:48:59 +09:00
parent 2448f26bc3
commit 9680991962
10 changed files with 315 additions and 29 deletions

View File

@@ -282,7 +282,13 @@ export class BatchManagementController {
firstMapping.from_api_key!,
firstMapping.from_table_name,
firstMapping.from_api_method as 'GET' | 'POST' | 'PUT' | 'DELETE' || 'GET',
mappings.map(m => m.from_column_name)
mappings.map(m => m.from_column_name),
100, // limit
// 파라미터 정보 전달
firstMapping.from_api_param_type,
firstMapping.from_api_param_name,
firstMapping.from_api_param_value,
firstMapping.from_api_param_source
);
console.log(`API 조회 결과:`, {
@@ -482,7 +488,16 @@ export class BatchManagementController {
*/
static async previewRestApiData(req: AuthenticatedRequest, res: Response) {
try {
const { apiUrl, apiKey, endpoint, method = 'GET' } = req.body;
const {
apiUrl,
apiKey,
endpoint,
method = 'GET',
paramType,
paramName,
paramValue,
paramSource
} = req.body;
if (!apiUrl || !apiKey || !endpoint) {
return res.status(400).json({
@@ -491,6 +506,15 @@ export class BatchManagementController {
});
}
console.log("🔍 REST API 미리보기 요청:", {
apiUrl,
endpoint,
paramType,
paramName,
paramValue,
paramSource
});
// RestApiConnector 사용하여 데이터 조회
const { RestApiConnector } = await import('../database/RestApiConnector');
@@ -503,8 +527,28 @@ export class BatchManagementController {
// 연결 테스트
await connector.connect();
// 파라미터가 있는 경우 엔드포인트 수정
let finalEndpoint = endpoint;
if (paramType && paramName && paramValue) {
if (paramType === 'url') {
// URL 파라미터: /api/users/{userId} → /api/users/123
if (endpoint.includes(`{${paramName}}`)) {
finalEndpoint = endpoint.replace(`{${paramName}}`, paramValue);
} else {
// 엔드포인트에 {paramName}이 없으면 뒤에 추가
finalEndpoint = `${endpoint}/${paramValue}`;
}
} else if (paramType === 'query') {
// 쿼리 파라미터: /api/users?userId=123
const separator = endpoint.includes('?') ? '&' : '?';
finalEndpoint = `${endpoint}${separator}${paramName}=${paramValue}`;
}
}
console.log("🔗 최종 엔드포인트:", finalEndpoint);
// 데이터 조회 (최대 5개만) - GET 메서드만 지원
const result = await connector.executeQuery(endpoint, method);
const result = await connector.executeQuery(finalEndpoint, method);
console.log(`[previewRestApiData] executeQuery 결과:`, {
rowCount: result.rowCount,
rowsLength: result.rows ? result.rows.length : 'undefined',