summaryrefslogtreecommitdiff
path: root/lib/vendor-investigation
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-11-05 19:56:29 +0900
committerjoonhoekim <26rote@gmail.com>2025-11-05 19:56:29 +0900
commit551129656039aae409b3af51ce4acbb59f60229f (patch)
treee041f542cd46920086e84d0071c9e0a76c4b8699 /lib/vendor-investigation
parente890fbae0c9c273b825ac808aa516de1f87fb218 (diff)
(김준회) approval: Saga Pattern 클래스로 리팩터링, 명시적으로 개선, 기존 사용 함수 리팩터링
Diffstat (limited to 'lib/vendor-investigation')
-rw-r--r--lib/vendor-investigation/approval-actions.ts20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/vendor-investigation/approval-actions.ts b/lib/vendor-investigation/approval-actions.ts
index e8e24ddc..74a25061 100644
--- a/lib/vendor-investigation/approval-actions.ts
+++ b/lib/vendor-investigation/approval-actions.ts
@@ -11,7 +11,7 @@
'use server';
-import { withApproval } from '@/lib/approval/approval-workflow';
+import { ApprovalSubmissionSaga } from '@/lib/approval';
import { mapPQInvestigationToTemplateVariables } from './handlers';
import { debugLog, debugError, debugSuccess } from '@/lib/debug-utils';
@@ -87,9 +87,9 @@ export async function requestPQInvestigationWithApproval(data: {
variableKeys: Object.keys(variables),
});
- // 3. 결재 워크플로우 시작
- debugLog('[PQInvestigationApproval] withApproval 호출');
- const result = await withApproval(
+ // 3. 결재 워크플로우 시작 (Saga 패턴)
+ debugLog('[PQInvestigationApproval] ApprovalSubmissionSaga 생성');
+ const saga = new ApprovalSubmissionSaga(
// actionType: 핸들러를 찾을 때 사용할 키
'pq_investigation_request',
@@ -114,6 +114,9 @@ export async function requestPQInvestigationWithApproval(data: {
}
);
+ debugLog('[PQInvestigationApproval] Saga 실행 시작');
+ const result = await saga.execute();
+
debugSuccess('[PQInvestigationApproval] 결재 워크플로우 완료', {
approvalId: result.approvalId,
pendingActionId: result.pendingActionId,
@@ -219,9 +222,9 @@ export async function reRequestPQInvestigationWithApproval(data: {
variableKeys: Object.keys(variables),
});
- // 4. 결재 워크플로우 시작
- debugLog('[PQReRequestApproval] withApproval 호출');
- const result = await withApproval(
+ // 4. 결재 워크플로우 시작 (Saga 패턴)
+ debugLog('[PQReRequestApproval] ApprovalSubmissionSaga 생성');
+ const saga = new ApprovalSubmissionSaga(
// actionType: 핸들러를 찾을 때 사용할 키
'pq_investigation_rerequest',
@@ -242,6 +245,9 @@ export async function reRequestPQInvestigationWithApproval(data: {
}
);
+ debugLog('[PQReRequestApproval] Saga 실행 시작');
+ const result = await saga.execute();
+
debugSuccess('[PQReRequestApproval] 재의뢰 결재 워크플로우 완료', {
approvalId: result.approvalId,
pendingActionId: result.pendingActionId,