summaryrefslogtreecommitdiff
path: root/lib/vendor-regular-registrations/approval-actions.ts
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-regular-registrations/approval-actions.ts
parente890fbae0c9c273b825ac808aa516de1f87fb218 (diff)
(김준회) approval: Saga Pattern 클래스로 리팩터링, 명시적으로 개선, 기존 사용 함수 리팩터링
Diffstat (limited to 'lib/vendor-regular-registrations/approval-actions.ts')
-rw-r--r--lib/vendor-regular-registrations/approval-actions.ts11
1 files changed, 7 insertions, 4 deletions
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로 변경');