260915_01_ENH: 다운로드 결과값 포함 및 컨택 이력 정렬 옵션 추가

This commit is contained in:
2026-09-15 12:30:52 +09:00
parent effe279be9
commit b543d66186
5 changed files with 73 additions and 10 deletions

View File

@@ -31,6 +31,7 @@ import type { ListTableRow } from '@/components/table-column/ListTableColumn'
import {
createEmptyListFilter,
ListEventHistoryBase,
ListEventHistoryOrder,
type LastListVisit,
type ListDownloadMode,
type ListDownloadPayload,
@@ -263,7 +264,7 @@ const ListManagePage = () => {
const listFilter = buildTargetFilter(payload.target)
if (payload.mode === 'list') {
const buffer = await downloadListMutation.mutateAsync(listFilter)
const buffer = await downloadListMutation.mutateAsync({ listFilter, includeResult: payload.includeResult })
downloadArrayBuffer(buffer, `${prjctName} list.xlsx`)
return
}
@@ -281,9 +282,11 @@ const ListManagePage = () => {
}
const buffer = await downloadListEventHistoryMutation.mutateAsync({
includeResult: payload.includeResult,
listFilter,
resultCodeTypes: [ResultCodeType.CONTACT, ResultCodeType.INTERVIEW, ResultCodeType.SURVEY],
searchBase: payload.contactHistoryType === 'latest' ? ListEventHistoryBase.LATEST : ListEventHistoryBase.ALL,
historyOrder: payload.historyOrder ?? ListEventHistoryOrder.DESC,
dateRange: toDateTimeRange(payload.contactHistoryDateFrom, payload.contactHistoryDateTo),
})
downloadArrayBuffer(buffer, `${prjctName} contact-history.xlsx`)

View File

@@ -108,7 +108,12 @@ export const POST = async (req: NextRequest, context: RouteContext) => {
if (action === "excel-download") {
const body = await req.json().catch(() => null);
const result = await contactApi.post<ArrayBuffer>(`/list/excel/download/${slug[1]}`, body, { expectBinary: true });
const includeResult = req.nextUrl.searchParams.get("includeResult") !== "false";
const result = await contactApi.post<ArrayBuffer>(
`/list/excel/download/${slug[1]}?includeResult=${includeResult}`,
body,
{ expectBinary: true },
);
return new NextResponse(result, { status: 200, headers: excelHeaders });
}
@@ -122,9 +127,12 @@ export const POST = async (req: NextRequest, context: RouteContext) => {
if (action === "event-history-download") {
const body = await req.json().catch(() => null);
const result = await contactApi.post<ArrayBuffer>(`/list-hist/excel/download/event/${slug[1]}`, body, {
expectBinary: true,
});
const includeResult = req.nextUrl.searchParams.get("includeResult") !== "false";
const result = await contactApi.post<ArrayBuffer>(
`/list-hist/excel/download/event/${slug[1]}?includeResult=${includeResult}`,
body,
{ expectBinary: true },
);
return new NextResponse(result, { status: 200, headers: excelHeaders });
}