flow-widget 인라인 편집 시 changed_by에 사용자 ID 기록되도록 수정

This commit is contained in:
dohyeons 2025-12-08 16:49:28 +09:00
parent ad5c7f643c
commit f0f6c42b3c
1 changed files with 11 additions and 1 deletions

View File

@ -360,7 +360,17 @@ export class FlowExecutionService {
console.log(`📝 [updateStepData] Query: ${updateQuery}`);
console.log(`📝 [updateStepData] Params:`, params);
await db.query(updateQuery, params);
// 트랜잭션으로 감싸서 사용자 ID 세션 변수 설정 후 업데이트 실행
// (트리거에서 changed_by를 기록하기 위함)
await db.query("BEGIN");
try {
await db.query(`SET LOCAL app.user_id = '${userId}'`);
await db.query(updateQuery, params);
await db.query("COMMIT");
} catch (txError) {
await db.query("ROLLBACK");
throw txError;
}
}
console.log(`✅ [updateStepData] Data updated successfully: ${tableName}.${primaryKeyColumn}=${recordId}`, {