From 551129656039aae409b3af51ce4acbb59f60229f Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Wed, 5 Nov 2025 19:56:29 +0900 Subject: (김준회) approval: Saga Pattern 클래스로 리팩터링, 명시적으로 개선, 기존 사용 함수 리팩터링 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/vendor-regular-registrations/approval-actions.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/vendor-regular-registrations/approval-actions.ts') diff --git a/lib/vendor-regular-registrations/approval-actions.ts b/lib/vendor-regular-registrations/approval-actions.ts index 298591e9..b90ef2b6 100644 --- a/lib/vendor-regular-registrations/approval-actions.ts +++ b/lib/vendor-regular-registrations/approval-actions.ts @@ -7,7 +7,7 @@ 'use server'; -import { withApproval } from '@/lib/approval/approval-workflow'; +import { ApprovalSubmissionSaga } from '@/lib/approval'; import { mapRegistrationToTemplateVariables } from './handlers'; import { debugLog, debugError, debugSuccess } from '@/lib/debug-utils'; import type { RegistrationRequestData } from '@/components/vendor-regular-registrations/registration-request-dialog'; @@ -70,9 +70,9 @@ export async function registerVendorWithApproval(data: { variableKeys: Object.keys(variables), }); - // 2. 결재 워크플로우 시작 (템플릿 기반) - debugLog('[VendorRegistrationApproval] withApproval 호출'); - const result = await withApproval( + // 2. 결재 워크플로우 시작 (Saga 패턴) + debugLog('[VendorRegistrationApproval] ApprovalSubmissionSaga 생성'); + const saga = new ApprovalSubmissionSaga( // actionType: 핸들러를 찾을 때 사용할 키 'vendor_regular_registration', @@ -93,6 +93,9 @@ export async function registerVendorWithApproval(data: { } ); + debugLog('[VendorRegistrationApproval] Saga 실행 시작'); + const result = await saga.execute(); + // 3. 결재 상신 성공 시 상태를 pending_approval로 변경 if (result.status === 'pending_approval') { debugLog('[VendorRegistrationApproval] 상태를 pending_approval로 변경'); -- cgit v1.2.3