제어 관리 저장 액션에 논리연산자 추가
This commit is contained in:
@@ -19,6 +19,7 @@ export interface ControlAction {
|
||||
id: string;
|
||||
name: string;
|
||||
actionType: "insert" | "update" | "delete";
|
||||
logicalOperator?: "AND" | "OR"; // 액션 간 논리 연산자 (첫 번째 액션 제외)
|
||||
conditions: ControlCondition[];
|
||||
fieldMappings: {
|
||||
sourceField?: string;
|
||||
@@ -136,17 +137,41 @@ export class DataflowControlService {
|
||||
};
|
||||
}
|
||||
|
||||
// 액션 실행
|
||||
// 액션 실행 (논리 연산자 지원)
|
||||
const executedActions = [];
|
||||
const errors = [];
|
||||
let previousActionSuccess = false;
|
||||
let shouldSkipRemainingActions = false;
|
||||
|
||||
for (let i = 0; i < targetPlan.actions.length; i++) {
|
||||
const action = targetPlan.actions[i];
|
||||
|
||||
for (const action of targetPlan.actions) {
|
||||
try {
|
||||
// 논리 연산자에 따른 실행 여부 결정
|
||||
if (
|
||||
i > 0 &&
|
||||
action.logicalOperator === "OR" &&
|
||||
previousActionSuccess
|
||||
) {
|
||||
console.log(
|
||||
`⏭️ OR 조건으로 인해 액션 건너뛰기: ${action.name} (이전 액션 성공)`
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (shouldSkipRemainingActions && action.logicalOperator === "AND") {
|
||||
console.log(
|
||||
`⏭️ 이전 액션 실패로 인해 AND 체인 액션 건너뛰기: ${action.name}`
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log(`⚡ 액션 실행: ${action.name} (${action.actionType})`);
|
||||
console.log(`📋 액션 상세 정보:`, {
|
||||
actionId: action.id,
|
||||
actionName: action.name,
|
||||
actionType: action.actionType,
|
||||
logicalOperator: action.logicalOperator,
|
||||
conditions: action.conditions,
|
||||
fieldMappings: action.fieldMappings,
|
||||
});
|
||||
@@ -163,6 +188,10 @@ export class DataflowControlService {
|
||||
console.log(
|
||||
`⚠️ 액션 조건 미충족: ${actionConditionResult.reason}`
|
||||
);
|
||||
previousActionSuccess = false;
|
||||
if (action.logicalOperator === "AND") {
|
||||
shouldSkipRemainingActions = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -173,11 +202,19 @@ export class DataflowControlService {
|
||||
actionName: action.name,
|
||||
result: actionResult,
|
||||
});
|
||||
|
||||
previousActionSuccess = true;
|
||||
shouldSkipRemainingActions = false; // 성공했으므로 다시 실행 가능
|
||||
} catch (error) {
|
||||
console.error(`❌ 액션 실행 오류: ${action.name}`, error);
|
||||
const errorMessage =
|
||||
error instanceof Error ? error.message : String(error);
|
||||
errors.push(`액션 '${action.name}' 실행 오류: ${errorMessage}`);
|
||||
|
||||
previousActionSuccess = false;
|
||||
if (action.logicalOperator === "AND") {
|
||||
shouldSkipRemainingActions = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user