docs: Phase 3.2 BatchService 완료 문서 업데이트 및 코드 포맷 정리
- PRISMA_TO_RAW_QUERY_MIGRATION_PLAN.md 업데이트 - BatchService (14개) 완료 표시 - Phase 3 진행률 반영 - batchService.ts 코드 포맷 정리 Phase 3 진행률: 39/162 (24.1%) 전체 진행률: 290/444 (65.3%)
This commit is contained in:
@@ -123,7 +123,7 @@ backend-node/ (루트)
|
||||
#### 🟠 **복잡 (Raw Query 혼재) - 2순위**
|
||||
|
||||
- `multilangService.ts` (0개) - ✅ **전환 완료** (Phase 3.1)
|
||||
- `batchService.ts` (16개) - 배치 작업 관리
|
||||
- `batchService.ts` (0개) - ✅ **전환 완료** (Phase 3.2)
|
||||
- `componentStandardService.ts` (16개) - 컴포넌트 표준 관리
|
||||
- `commonCodeService.ts` (15개) - 코드 관리, 계층 구조
|
||||
- `dataflowDiagramService.ts` (12개) - 다이어그램 관리 ⭐ 신규 발견
|
||||
@@ -1137,8 +1137,17 @@ describe("Performance Benchmarks", () => {
|
||||
- [x] IN 절 동적 파라미터 바인딩
|
||||
- [x] TypeScript 컴파일 성공
|
||||
- [x] Prisma import 완전 제거
|
||||
- [ ] 배치 관련 서비스 전환 (40개) ⭐ 대규모 신규 발견
|
||||
- [ ] BatchService (16개), BatchExternalDbService (8개)
|
||||
- [x] **BatchService 전환 (14개)** ✅ **완료** (Phase 3.2)
|
||||
- [x] 14개 Prisma 호출 전환 완료 (배치 설정 CRUD)
|
||||
- [x] 동적 WHERE 조건 생성 (ILIKE 검색, 페이지네이션)
|
||||
- [x] 동적 UPDATE 쿼리 (변경된 필드만 업데이트)
|
||||
- [x] 복잡한 트랜잭션 (배치 설정 + 매핑 동시 생성/수정/삭제)
|
||||
- [x] LEFT JOIN으로 배치 매핑 조회 (json_agg, COALESCE)
|
||||
- [x] transaction 함수 활용 (client.query().rows 처리)
|
||||
- [x] TypeScript 컴파일 성공
|
||||
- [x] Prisma import 완전 제거
|
||||
- [ ] 배치 관련 서비스 전환 (26개) ⭐ 대규모 신규 발견
|
||||
- [ ] BatchExternalDbService (8개)
|
||||
- [ ] BatchExecutionLogService (7개), BatchManagementService (5개)
|
||||
- [ ] BatchSchedulerService (4개)
|
||||
- [ ] 표준 관리 서비스 전환 (41개)
|
||||
|
||||
@@ -184,13 +184,7 @@ export class BatchService {
|
||||
(batch_name, description, cron_schedule, created_by, updated_by, created_date, updated_date)
|
||||
VALUES ($1, $2, $3, $4, $5, NOW(), NOW())
|
||||
RETURNING *`,
|
||||
[
|
||||
data.batchName,
|
||||
data.description,
|
||||
data.cronSchedule,
|
||||
userId,
|
||||
userId,
|
||||
]
|
||||
[data.batchName, data.description, data.cronSchedule, userId, userId]
|
||||
);
|
||||
|
||||
const batchConfig = batchConfigResult.rows[0];
|
||||
@@ -297,7 +291,10 @@ export class BatchService {
|
||||
// 트랜잭션으로 업데이트
|
||||
const result = await transaction(async (client) => {
|
||||
// 동적 UPDATE 쿼리 생성
|
||||
const updateFields: string[] = ["updated_by = $1", "updated_date = NOW()"];
|
||||
const updateFields: string[] = [
|
||||
"updated_by = $1",
|
||||
"updated_date = NOW()",
|
||||
];
|
||||
const updateValues: any[] = [userId];
|
||||
let paramIndex = 2;
|
||||
|
||||
@@ -740,9 +737,7 @@ export class BatchService {
|
||||
|
||||
if (connectionType === "internal") {
|
||||
// 내부 DB에서 데이터 조회 (주의: SQL 인젝션 위험 - 실제 프로덕션에서는 테이블명 검증 필요)
|
||||
const result = await query<any>(
|
||||
`SELECT * FROM ${tableName} LIMIT 100`
|
||||
);
|
||||
const result = await query<any>(`SELECT * FROM ${tableName} LIMIT 100`);
|
||||
console.log(
|
||||
`[BatchService] 내부 DB 데이터 조회 결과: ${result.length}개 레코드`
|
||||
);
|
||||
@@ -913,10 +908,9 @@ export class BatchService {
|
||||
const result = await transaction(async (client) => {
|
||||
// 먼저 해당 레코드가 존재하는지 확인
|
||||
const checkQuery = `SELECT COUNT(*) as count FROM ${tableName} WHERE ${primaryKeyColumn} = $1`;
|
||||
const existsResult = await client.query(
|
||||
checkQuery,
|
||||
[record[primaryKeyColumn]]
|
||||
);
|
||||
const existsResult = await client.query(checkQuery, [
|
||||
record[primaryKeyColumn],
|
||||
]);
|
||||
const exists = parseInt(existsResult.rows[0]?.count || "0") > 0;
|
||||
|
||||
let operationResult = "no_change";
|
||||
@@ -947,10 +941,7 @@ export class BatchService {
|
||||
record[primaryKeyColumn],
|
||||
...updateColumns.map((col) => record[col]),
|
||||
];
|
||||
const updateResult = await client.query(
|
||||
query,
|
||||
updateValues
|
||||
);
|
||||
const updateResult = await client.query(query, updateValues);
|
||||
|
||||
if (updateResult.rowCount && updateResult.rowCount > 0) {
|
||||
console.log(
|
||||
|
||||
Reference in New Issue
Block a user