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

@@ -697,7 +697,12 @@ export class BatchExternalDbService {
endpoint: string,
method: 'GET' | 'POST' | 'PUT' | 'DELETE' = 'GET',
columns?: string[],
limit: number = 100
limit: number = 100,
// 파라미터 정보 추가
paramType?: 'url' | 'query',
paramName?: string,
paramValue?: string,
paramSource?: 'static' | 'dynamic'
): Promise<ApiResponse<any[]>> {
try {
console.log(`[BatchExternalDbService] REST API 데이터 조회: ${apiUrl}${endpoint}`);
@@ -712,8 +717,33 @@ export class BatchExternalDbService {
// 연결 테스트
await connector.connect();
// 파라미터가 있는 경우 엔드포인트 수정
const { logger } = await import('../utils/logger');
logger.info(`[BatchExternalDbService] 파라미터 정보`, {
paramType, paramName, paramValue, paramSource
});
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}`;
}
logger.info(`[BatchExternalDbService] 파라미터 적용된 엔드포인트: ${finalEndpoint}`);
}
// 데이터 조회
const result = await connector.executeQuery(endpoint, method);
const result = await connector.executeQuery(finalEndpoint, method);
let data = result.rows;
// 컬럼 필터링 (지정된 컬럼만 추출)
@@ -734,7 +764,8 @@ export class BatchExternalDbService {
data = data.slice(0, limit);
}
console.log(`[BatchExternalDbService] REST API 데이터 조회 완료: ${data.length}개 레코드`);
logger.info(`[BatchExternalDbService] REST API 데이터 조회 완료: ${data.length}개 레코드`);
logger.info(`[BatchExternalDbService] 조회된 데이터`, { data });
return {
success: true,