261013_01_HOT: 리스트 엑셀 업로드·다운로드 및 컨택이력 다운로드 timeout 5분으로 연장
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import {RouteContext} from "@/types/common";
|
|||||||
import {createContactApi} from "@/lib/http-server";
|
import {createContactApi} from "@/lib/http-server";
|
||||||
import {errorToResponse} from "@kri/common/http";
|
import {errorToResponse} from "@kri/common/http";
|
||||||
import {listHeader, ListSearchRequest, ListSearchWithFullResult} from "@/types/list";
|
import {listHeader, ListSearchRequest, ListSearchWithFullResult} from "@/types/list";
|
||||||
|
import {LIST_EXCEL_TIMEOUT_MS} from "@/const/listConst";
|
||||||
|
|
||||||
const excelHeaders = {
|
const excelHeaders = {
|
||||||
"Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
"Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||||
@@ -102,7 +103,9 @@ export const POST = async (req: NextRequest, context: RouteContext) => {
|
|||||||
|
|
||||||
if (action === "excel-upload") {
|
if (action === "excel-upload") {
|
||||||
const form = await req.formData();
|
const form = await req.formData();
|
||||||
const result = await contactApi.postForm(`/list/excel/upload/${slug[1]}`, form);
|
const result = await contactApi.postForm(`/list/excel/upload/${slug[1]}`, form, {
|
||||||
|
timeoutMs: LIST_EXCEL_TIMEOUT_MS,
|
||||||
|
});
|
||||||
return NextResponse.json(result, { status: 200 });
|
return NextResponse.json(result, { status: 200 });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +115,7 @@ export const POST = async (req: NextRequest, context: RouteContext) => {
|
|||||||
const result = await contactApi.post<ArrayBuffer>(
|
const result = await contactApi.post<ArrayBuffer>(
|
||||||
`/list/excel/download/${slug[1]}?includeResult=${includeResult}`,
|
`/list/excel/download/${slug[1]}?includeResult=${includeResult}`,
|
||||||
body,
|
body,
|
||||||
{ expectBinary: true },
|
{ expectBinary: true, timeoutMs: LIST_EXCEL_TIMEOUT_MS },
|
||||||
);
|
);
|
||||||
return new NextResponse(result, { status: 200, headers: excelHeaders });
|
return new NextResponse(result, { status: 200, headers: excelHeaders });
|
||||||
}
|
}
|
||||||
@@ -131,7 +134,7 @@ export const POST = async (req: NextRequest, context: RouteContext) => {
|
|||||||
const result = await contactApi.post<ArrayBuffer>(
|
const result = await contactApi.post<ArrayBuffer>(
|
||||||
`/list-hist/excel/download/event/${slug[1]}?includeResult=${includeResult}`,
|
`/list-hist/excel/download/event/${slug[1]}?includeResult=${includeResult}`,
|
||||||
body,
|
body,
|
||||||
{ expectBinary: true },
|
{ expectBinary: true, timeoutMs: LIST_EXCEL_TIMEOUT_MS },
|
||||||
);
|
);
|
||||||
return new NextResponse(result, { status: 200, headers: excelHeaders });
|
return new NextResponse(result, { status: 200, headers: excelHeaders });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,3 +74,6 @@ export const LIST_HEADER_TYPE_OPTIONS = LIST_HEADER_TYPE_ORDER.map((value) => ({
|
|||||||
|
|
||||||
// 일괄 수정에서 FILE 헤더 항목값으로 이 값을 보내면 서버가 업로드된 파일을 삭제 처리한다.
|
// 일괄 수정에서 FILE 헤더 항목값으로 이 값을 보내면 서버가 업로드된 파일을 삭제 처리한다.
|
||||||
export const LIST_BATCH_EDIT_FILE_DELETE_VALUE = "FILE_DELETE";
|
export const LIST_BATCH_EDIT_FILE_DELETE_VALUE = "FILE_DELETE";
|
||||||
|
|
||||||
|
// 대용량 리스트 엑셀 업로드/다운로드는 기본 timeout(60초)을 넘길 수 있어 해당 호출에만 별도로 적용한다.
|
||||||
|
export const LIST_EXCEL_TIMEOUT_MS = 5 * 60 * 1000;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
ListUploadRequest,
|
ListUploadRequest,
|
||||||
} from "@/types/list";
|
} from "@/types/list";
|
||||||
import type { ExcelUploadResult, PageResponse } from "@kri/common";
|
import type { ExcelUploadResult, PageResponse } from "@kri/common";
|
||||||
import {ListHeaderAssignConst} from "@/const/listConst";
|
import {LIST_EXCEL_TIMEOUT_MS, ListHeaderAssignConst} from "@/const/listConst";
|
||||||
import {ResultCodeType} from "@/types/project";
|
import {ResultCodeType} from "@/types/project";
|
||||||
|
|
||||||
export function useListHeaderQuery(prjctIdx: number, enabled: boolean) {
|
export function useListHeaderQuery(prjctIdx: number, enabled: boolean) {
|
||||||
@@ -195,7 +195,9 @@ export function useUploadListExcelMutation(prjctIdx: number) {
|
|||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
formData.append("file", file);
|
formData.append("file", file);
|
||||||
formData.append("request", new Blob([JSON.stringify(request)], { type: "application/json" }));
|
formData.append("request", new Blob([JSON.stringify(request)], { type: "application/json" }));
|
||||||
return nextApi.postForm<ExcelUploadResult>(`/list/excel-upload/${prjctIdx}`, formData);
|
return nextApi.postForm<ExcelUploadResult>(`/list/excel-upload/${prjctIdx}`, formData, {
|
||||||
|
timeoutMs: LIST_EXCEL_TIMEOUT_MS,
|
||||||
|
});
|
||||||
},
|
},
|
||||||
onSuccess: async () => {
|
onSuccess: async () => {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
@@ -278,6 +280,7 @@ export function useDownloadListMutation(prjctIdx: number) {
|
|||||||
mutationFn: ({ listFilter, includeResult }: { listFilter: ListFilter; includeResult: boolean }) =>
|
mutationFn: ({ listFilter, includeResult }: { listFilter: ListFilter; includeResult: boolean }) =>
|
||||||
nextApi.post<ArrayBuffer>(`/list/excel-download/${prjctIdx}?includeResult=${includeResult}`, listFilter, {
|
nextApi.post<ArrayBuffer>(`/list/excel-download/${prjctIdx}?includeResult=${includeResult}`, listFilter, {
|
||||||
expectBinary: true,
|
expectBinary: true,
|
||||||
|
timeoutMs: LIST_EXCEL_TIMEOUT_MS,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -294,6 +297,7 @@ export function useDownloadListEventHistoryMutation(prjctIdx: number) {
|
|||||||
mutationFn: ({ includeResult, ...request }: ListEventHistDownloadRequest & { includeResult: boolean }) =>
|
mutationFn: ({ includeResult, ...request }: ListEventHistDownloadRequest & { includeResult: boolean }) =>
|
||||||
nextApi.post<ArrayBuffer>(`/list/event-history-download/${prjctIdx}?includeResult=${includeResult}`, request, {
|
nextApi.post<ArrayBuffer>(`/list/event-history-download/${prjctIdx}?includeResult=${includeResult}`, request, {
|
||||||
expectBinary: true,
|
expectBinary: true,
|
||||||
|
timeoutMs: LIST_EXCEL_TIMEOUT_MS,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user