diff options
Diffstat (limited to 'lib/vendor-investigation/approval-actions.ts')
| -rw-r--r-- | lib/vendor-investigation/approval-actions.ts | 20 |
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, |
