blob: 7f3261bc1d861bdaa790492b7e23350a0fcb3b49 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/**
* 결재 후 실행될 액션 핸들러 중앙 등록소
*
* 모든 결재 가능한 액션의 핸들러를 한 곳에서 등록
* 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 실사의뢰 핸들러 등록 (결재 승인 후 실행될 함수 requestPQInvestigationInternal )
registerActionHandler('pq_investigation_request', requestPQInvestigationInternal);
// PQ 실사 재의뢰 핸들러 등록 (결재 승인 후 실행될 함수 reRequestPQInvestigationInternal )
registerActionHandler('pq_investigation_rerequest', reRequestPQInvestigationInternal);
// 2. 발주 요청 핸들러
// const { createPurchaseOrderInternal } = await import('@/lib/purchase-order/handlers');
// registerActionHandler('purchase_order_request', createPurchaseOrderInternal);
// 3. 정규업체 등록 핸들러
const { registerVendorInternal } = await import('@/lib/vendor-regular-registrations/handlers');
// 정규업체 등록 핸들러 등록 (결재 승인 후 실행될 함수 registerVendorInternal )
registerActionHandler('vendor_regular_registration', registerVendorInternal);
// 4. 벤더 가입 승인 핸들러
const { approveVendorWithMDGInternal } = await import('@/lib/vendors/approval-handlers');
// 벤더 가입 승인 핸들러 등록 (결재 승인 후 실행될 함수 approveVendorWithMDGInternal)
registerActionHandler('vendor_approval', approveVendorWithMDGInternal);
// 5. 계약 승인 핸들러
// 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();
}
|