diff options
Diffstat (limited to 'lib/swp/actions.ts')
| -rw-r--r-- | lib/swp/actions.ts | 60 |
1 files changed, 60 insertions, 0 deletions
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 : "파일 취소 실패" + ); + } +} |
