diff options
Diffstat (limited to 'lib/swp/api-client.ts')
| -rw-r--r-- | lib/swp/api-client.ts | 160 |
1 files changed, 155 insertions, 5 deletions
diff --git a/lib/swp/api-client.ts b/lib/swp/api-client.ts index 9ce8c5c1..3ac980fb 100644 --- a/lib/swp/api-client.ts +++ b/lib/swp/api-client.ts @@ -1,10 +1,5 @@ "use server"; -import type { - SwpDocumentApiResponse, - SwpFileApiResponse, -} from "./sync-service"; - // ============================================================================ // SWP API 클라이언트 // ============================================================================ @@ -47,6 +42,72 @@ export interface GetExternalInboxListFilter { doctitle?: string; } +export interface SwpDocumentApiResponse { + // 필수 필드 + DOC_NO: string; + DOC_TITLE: string; + PROJ_NO: string; + CPY_CD: string; + CPY_NM: string; + PIC_NM: string; + PIC_DEPTNM: string; + SKL_CD: string; + CRTER: string; + CRTE_DTM: string; + CHGR: string; + CHG_DTM: string; + + // 선택적 필드 (null 가능) + DOC_GB: string | null; + DOC_TYPE: string | null; + OWN_DOC_NO: string | null; + SHI_DOC_NO: string | null; + PROJ_NM: string | null; + PKG_NO: string | null; + MAT_CD: string | null; + MAT_NM: string | null; + DISPLN: string | null; + CTGRY: string | null; + VNDR_CD: string | null; + PIC_DEPTCD: string | null; + LTST_REV_NO: string | null; + LTST_REV_SEQ: string | null; + LTST_ACTV_STAT: string | null; + STAGE: string | null; + MOD_TYPE: string | null; + ACT_TYPE_NM: string | null; + USE_YN: string | null; + REV_DTM: string | null; +} + +export interface SwpFileApiResponse { + // 필수 필드 + OWN_DOC_NO: string; + REV_NO: string; + STAGE: string; + FILE_NM: string; + FILE_SEQ: string; + CRTER: string; + CRTE_DTM: string; + CHGR: string; + CHG_DTM: string; + + // 선택적 필드 (null 가능) + FILE_SZ: string | null; + FLD_PATH: string | null; + ACTV_NO: string | null; + ACTV_SEQ: string | null; + BOX_SEQ: string | null; + OFDC_NO: string | null; + PROJ_NO: string | null; + PKG_NO: string | null; + VNDR_CD: string | null; + CPY_CD: string | null; + STAT: string | null; + STAT_NM: string | null; + IDX: string | null; +} + // ============================================================================ // 공통 API 호출 함수 // ============================================================================ @@ -302,3 +363,92 @@ export async function analyzeSwpData( }; } +// ============================================================================ +// 서버 액션: Activity 및 파일 리스트 조회 (GetActivityFileList) +// ============================================================================ + +/** + * Activity 파일 리스트 조회 필터 + */ +export interface GetActivityFileListFilter { + proj_no: string; + doc_no: string; + rev_seq?: string; // 선택적 +} + +/** + * Activity 파일 API 응답 + */ +export interface ActivityFileApiResponse { + ACTV_NO: string; + ACT_TYPE: string; + DOC_NO: string; + DOC_TITLE: string; + REV_NO: string; + REV_SEQ: string; + STAGE: string; + STAT: string; // R00=Receive, S30=Send, V00=Review + FILE_TYPE: string; // "Receive", "Send", "Review" + FILE_NM: string; + FILE_SEQ: string; + FILE_SZ: string; + FILE_FMT: string; + OWN_DOC_NO: string; + TO_FROM: string; // 업체명 + OBJT_ID: string; + DSC: string | null; + BATCHUPLOAD_ID: string | null; + TRNS_DTM: string | null; + CRTER: string; + CRTE_DTM: string; +} + +/** + * Activity 파일 리스트 조회 (GetActivityFileList) + * @param filter 조회 필터 + */ +export async function fetchGetActivityFileList( + filter: GetActivityFileListFilter +): Promise<ActivityFileApiResponse[]> { + const body = { + proj_no: filter.proj_no, + doc_no: filter.doc_no, + rev_seq: filter.rev_seq || "", + }; + + return callSwpApi<ActivityFileApiResponse>( + "GetActivityFileList", + body, + "GetActivityFileListResult" + ); +} + +// ============================================================================ +// 서버 액션: 파일 취소 (SaveInBoxListCancelStatus) +// ============================================================================ + +export interface CancelFileParams { + boxSeq: string; + actvSeq: string; + chgr: string; // 취소 요청자 (evcp${userId}) +} + +/** + * 파일 취소 API (SaveInBoxListCancelStatus) + */ +export async function callSaveInBoxListCancelStatus( + params: CancelFileParams +): Promise<void> { + const body = { + boxSeq: params.boxSeq, + actvSeq: params.actvSeq, + chgr: params.chgr, + }; + + await callSwpApi( + "SaveInBoxListCancelStatus", + body, + "SaveInBoxListCancelStatusResult" + ); +} + |
