diff options
Diffstat (limited to 'lib/vendor-investigation/handlers.ts')
| -rw-r--r-- | lib/vendor-investigation/handlers.ts | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/vendor-investigation/handlers.ts b/lib/vendor-investigation/handlers.ts index 3165df06..b7da952a 100644 --- a/lib/vendor-investigation/handlers.ts +++ b/lib/vendor-investigation/handlers.ts @@ -37,18 +37,34 @@ export async function requestPQInvestigationInternal(payload: { throw new Error(errorMessage); } + // ✅ Date 문자열을 Date 객체로 변환 + // DB의 jsonb에서 읽을 때 Date 객체가 ISO 문자열로 변환되어 있음 + const forecastedAt = typeof payload.forecastedAt === 'string' + ? new Date(payload.forecastedAt) + : payload.forecastedAt; + + debugLog('[PQInvestigationHandler] Date 변환 완료', { + originalType: typeof payload.forecastedAt, + convertedType: typeof forecastedAt, + forecastedAt: forecastedAt.toISOString(), + }); + try { // 기존 PQ 서비스 함수 사용 (DB 트랜잭션 포함) const { requestInvestigationAction } = await import('@/lib/pq/service'); + debugLog('[PQInvestigationHandler] requestInvestigationAction 호출'); const result = await requestInvestigationAction( payload.pqSubmissionIds, { id: payload.currentUserId, epId: null, email: undefined }, // ✅ 실제 사용자 ID 전달 { qmManagerId: payload.qmManagerId, - forecastedAt: payload.forecastedAt, + forecastedAt: forecastedAt, // ✅ Date 객체 전달 investigationAddress: payload.investigationAddress, investigationNotes: payload.investigationNotes, + }, + { + skipRevalidation: true, // ✅ 폴링 컨텍스트에서는 revalidation 건너뛰기 } ); @@ -133,9 +149,13 @@ export async function reRequestPQInvestigationInternal(payload: { // 기존 PQ 서비스 함수 사용 const { reRequestInvestigationAction } = await import('@/lib/pq/service'); + debugLog('[PQReRequestHandler] reRequestInvestigationAction 호출'); const result = await reRequestInvestigationAction( payload.investigationIds, - { id: payload.currentUserId } // ✅ 실제 사용자 ID 전달 + { id: payload.currentUserId }, // ✅ 실제 사용자 ID 전달 + { + skipRevalidation: true, // ✅ 폴링 컨텍스트에서는 revalidation 건너뛰기 + } ); if (!result.success) { |
