From 29db5e657d738964d313d609629ce6b0e326bc15 Mon Sep 17 00:00:00 2001 From: "cyril.tsui" Date: Thu, 21 Aug 2025 11:55:06 +0800 Subject: [PATCH] update --- src/app/api/escalation/index.ts | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/app/api/escalation/index.ts diff --git a/src/app/api/escalation/index.ts b/src/app/api/escalation/index.ts new file mode 100644 index 0000000..1c0d0f2 --- /dev/null +++ b/src/app/api/escalation/index.ts @@ -0,0 +1,53 @@ +"server only" + +import { convertObjToURLSearchParams } from "@/app/utils/commonUtil"; +import { serverFetchJson } from "@/app/utils/fetchUtil"; +import { BASE_API_URL } from "@/config/api"; +import { cache } from "react"; + +export interface EscalationResult { + id: number; + personInChargeDepartment?: string; + personInChargeName?: string; + personInChargeTitle?: string; + polId?: number; + poId?: number; + reason?: string; + personInChargeId?: number; + itemName?: string; + demandQty?: number; + acceptedQty?: number; + stockInLineId?: number; + stockOutLineId?: number; + qcFailCount?: number; + qcTotalCount?: number; + poCode?: string; + itemCode?: string; + dnDate?: number[]; + dnNo?: string; +} + +export const fetchEscalationLogsByStockInLines = cache(async(stockInLineIds: number[]) => { + const searchParams = convertObjToURLSearchParams({stockInLineIds: stockInLineIds}) + return serverFetchJson(`${BASE_API_URL}/escalationLog/stockInLines?${searchParams}`, + { + method: "GET", + headers: { "Content-Type": "application/json" }, + next: { + tags: ["escalationLogs"], + }, + }, + ); +}); + +export const fetchEscalationLogsByUser = cache(async() => { + return serverFetchJson(`${BASE_API_URL}/escalationLog/user`, + { + method: "GET", + headers: { "Content-Type": "application/json" }, + next: { + tags: ["escalationLogs"], + }, + }, + ); +}); \ No newline at end of file