summaryrefslogtreecommitdiff
path: root/lib/approval/handlers-registry.ts
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-10-23 18:13:41 +0900
committerjoonhoekim <26rote@gmail.com>2025-10-23 18:13:41 +0900
commit78c471eec35182959e0029ded18f144974ccaca2 (patch)
tree914cdf1c8f406ca3e2aa639b8bb774f7f4e87023 /lib/approval/handlers-registry.ts
parent0be8940580c4a4a4e098b649d198160f9b60420c (diff)
(김준회) 결재 템플릿 에디터 및 결재 워크플로 공통함수 작성, 실사의뢰 결재 연결 예시 작성
Diffstat (limited to 'lib/approval/handlers-registry.ts')
-rw-r--r--lib/approval/handlers-registry.ts49
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/approval/handlers-registry.ts b/lib/approval/handlers-registry.ts
new file mode 100644
index 00000000..1e8140e5
--- /dev/null
+++ b/lib/approval/handlers-registry.ts
@@ -0,0 +1,49 @@
+/**
+ * 결재 액션 핸들러 중앙 등록소
+ *
+ * 모든 결재 가능한 액션의 핸들러를 한 곳에서 등록
+ * instrumentation.ts 또는 Next.js middleware에서 import하여 초기화
+ */
+
+import { registerActionHandler } from './approval-workflow';
+
+/**
+ * 모든 핸들러를 등록하는 초기화 함수
+ * 앱 시작 시 한 번만 호출
+ */
+export async function initializeApprovalHandlers() {
+ console.log('[Approval Handlers] Registering all handlers...');
+
+ // 1. PQ 실사 관련 핸들러
+ const {
+ requestPQInvestigationInternal,
+ reRequestPQInvestigationInternal
+ } = await import('@/lib/vendor-investigation/handlers');
+
+ // PQ 실사의뢰 핸들러 등록
+ registerActionHandler('pq_investigation_request', requestPQInvestigationInternal);
+
+ // PQ 실사 재의뢰 핸들러 등록
+ registerActionHandler('pq_investigation_rerequest', reRequestPQInvestigationInternal);
+
+ // 2. 발주 요청 핸들러
+ // const { createPurchaseOrderInternal } = await import('@/lib/purchase-order/handlers');
+ // registerActionHandler('purchase_order_request', createPurchaseOrderInternal);
+
+ // 3. 계약 승인 핸들러
+ // const { approveContractInternal } = await import('@/lib/contract/handlers');
+ // registerActionHandler('contract_approval', approveContractInternal);
+
+ // ... 추가 핸들러 등록
+
+ console.log('[Approval Handlers] All handlers registered successfully');
+}
+
+/**
+ * 등록된 모든 핸들러 목록 조회 (디버깅용)
+ */
+export async function listRegisteredHandlers() {
+ const { getRegisteredHandlers } = await import('./approval-workflow');
+ return await getRegisteredHandlers();
+}
+