diff --git a/PRISMA_TO_RAW_QUERY_MIGRATION_PLAN.md b/PRISMA_TO_RAW_QUERY_MIGRATION_PLAN.md index 08b041fc..67dacab9 100644 --- a/PRISMA_TO_RAW_QUERY_MIGRATION_PLAN.md +++ b/PRISMA_TO_RAW_QUERY_MIGRATION_PLAN.md @@ -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๊ฐœ) diff --git a/backend-node/src/services/batchService.ts b/backend-node/src/services/batchService.ts index 19ceea52..00d87d66 100644 --- a/backend-node/src/services/batchService.ts +++ b/backend-node/src/services/batchService.ts @@ -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( - `SELECT * FROM ${tableName} LIMIT 100` - ); + const result = await query(`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(