summaryrefslogtreecommitdiff
path: root/lib/swp/api-client.ts
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-10-29 15:59:04 +0900
committerjoonhoekim <26rote@gmail.com>2025-10-29 15:59:04 +0900
commit2ecdac866c19abea0b5389708fcdf5b3889c969a (patch)
treee02a02cfa0890691fb28a7df3a96ef495b3d4b79 /lib/swp/api-client.ts
parent2fc9e5492e220041ba322d9a1479feb7803228cf (diff)
(김준회) SWP 파일 업로드 취소 기능 추가, 업로드 파일명 검증로직에서 파일명 비필수로 변경
Diffstat (limited to 'lib/swp/api-client.ts')
-rw-r--r--lib/swp/api-client.ts160
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"
+ );
+}
+