From 2ecdac866c19abea0b5389708fcdf5b3889c969a Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Wed, 29 Oct 2025 15:59:04 +0900 Subject: (김준회) SWP 파일 업로드 취소 기능 추가, 업로드 파일명 검증로직에서 파일명 비필수로 변경 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/swp/actions.ts | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'lib/swp/actions.ts') diff --git a/lib/swp/actions.ts b/lib/swp/actions.ts index a7b4d3a3..eea8c9c2 100644 --- a/lib/swp/actions.ts +++ b/lib/swp/actions.ts @@ -474,3 +474,63 @@ function getMimeType(fileName: string): string { return mimeTypes[ext] || "application/octet-stream"; } + +// ============================================================================ +// 서버 액션: 벤더 업로드 파일 목록 조회 +// ============================================================================ + +export async function fetchVendorUploadedFiles(projNo: string, vndrCd: string) { + try { + debugLog(`[fetchVendorUploadedFiles] 조회 시작`, { projNo, vndrCd }); + + // fetchGetExternalInboxList 호출 + const { fetchGetExternalInboxList } = await import("./api-client"); + const files = await fetchGetExternalInboxList({ + projNo, + vndrCd, + }); + + debugLog(`[fetchVendorUploadedFiles] 조회 완료`, { + fileCount: files.length + }); + + return files; + } catch (error) { + debugError(`[fetchVendorUploadedFiles] 조회 실패`, { error }); + throw new Error( + error instanceof Error ? error.message : "업로드 파일 목록 조회 실패" + ); + } +} + +// ============================================================================ +// 서버 액션: 벤더 업로드 파일 취소 +// ============================================================================ + +export interface CancelUploadedFileParams { + boxSeq: string; + actvSeq: string; + userId: string; +} + +export async function cancelVendorUploadedFile(params: CancelUploadedFileParams) { + try { + debugLog(`[cancelVendorUploadedFile] 취소 시작`, params); + + const { callSaveInBoxListCancelStatus } = await import("./api-client"); + await callSaveInBoxListCancelStatus({ + boxSeq: params.boxSeq, + actvSeq: params.actvSeq, + chgr: `evcp${params.userId}`, + }); + + debugSuccess(`[cancelVendorUploadedFile] 취소 완료`, params); + + return { success: true }; + } catch (error) { + debugError(`[cancelVendorUploadedFile] 취소 실패`, { error }); + throw new Error( + error instanceof Error ? error.message : "파일 취소 실패" + ); + } +} -- cgit v1.2.3