Merge branch 'main' into feature/screen-management

This commit is contained in:
kjs
2026-01-07 11:55:45 +09:00
7 changed files with 311 additions and 22 deletions

View File

@@ -2282,6 +2282,7 @@ export class NodeFlowExecutionService {
UPDATE ${targetTable}
SET ${setClauses.join(", ")}
WHERE ${updateWhereConditions}
RETURNING *
`;
logger.info(`🔄 UPDATE 실행:`, {
@@ -2292,8 +2293,14 @@ export class NodeFlowExecutionService {
values: updateValues,
});
await txClient.query(updateSql, updateValues);
const updateResult = await txClient.query(updateSql, updateValues);
updatedCount++;
// 🆕 UPDATE 결과를 입력 데이터에 병합 (다음 노드에서 id 등 사용 가능)
if (updateResult.rows && updateResult.rows[0]) {
Object.assign(data, updateResult.rows[0]);
logger.info(` 📦 UPDATE 결과 병합: id=${updateResult.rows[0].id}`);
}
} else {
// 3-B. 없으면 INSERT
const columns: string[] = [];
@@ -2340,6 +2347,7 @@ export class NodeFlowExecutionService {
const insertSql = `
INSERT INTO ${targetTable} (${columns.join(", ")})
VALUES (${placeholders})
RETURNING *
`;
logger.info(` INSERT 실행:`, {
@@ -2348,8 +2356,14 @@ export class NodeFlowExecutionService {
conflictKeyValues,
});
await txClient.query(insertSql, values);
const insertResult = await txClient.query(insertSql, values);
insertedCount++;
// 🆕 INSERT 결과를 입력 데이터에 병합 (다음 노드에서 id 등 사용 가능)
if (insertResult.rows && insertResult.rows[0]) {
Object.assign(data, insertResult.rows[0]);
logger.info(` 📦 INSERT 결과 병합: id=${insertResult.rows[0].id}`);
}
}
}
@@ -2357,11 +2371,10 @@ export class NodeFlowExecutionService {
`✅ UPSERT 완료 (내부 DB): ${targetTable}, INSERT ${insertedCount}건, UPDATE ${updatedCount}`
);
return {
insertedCount,
updatedCount,
totalCount: insertedCount + updatedCount,
};
// 🔥 다음 노드에 전달할 데이터 반환
// dataArray에는 Object.assign으로 UPSERT 결과(id 등)가 이미 병합되어 있음
// 카운트 정보도 함께 반환하여 기존 호환성 유지
return dataArray;
};
// 🔥 클라이언트가 전달되었으면 사용, 아니면 독립 트랜잭션 생성