260623_02_ENH: 엑셀 다운로드를 포함한 1차 개발 완료

This commit is contained in:
2026-06-23 11:38:46 +09:00
parent 08ea4d5420
commit d3592ad81b
9 changed files with 141 additions and 9 deletions

View File

@@ -72,6 +72,28 @@ export const POST = async (
return new NextResponse(result, { status: 200 });
}
if (action === "excel-download" && slug.length === 1) {
const body = await req.json().catch(() => null);
if (!Array.isArray(body)) {
return NextResponse.json({ message: "Request body must be an array." }, { status: 400 });
}
const result = await backApi.post<ArrayBuffer>(
"/performance/excel/download",
body,
{ expectBinary: true }
);
return new NextResponse(result, {
status: 200,
headers: {
"Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"Content-Disposition": `attachment; filename="performance.xlsx"`,
},
});
}
return NextResponse.json({ message: "Not found" }, { status: 404 });
} catch (error: unknown) {
return errorToResponse(error);

View File

@@ -73,6 +73,28 @@ export const POST = async (
});
}
if (action === "excel-download" && slug.length === 2) {
const body = await req.json().catch(() => null);
if (!Array.isArray(body)) {
return NextResponse.json({ message: "Request body must be an array." }, { status: 400 });
}
const result = await backApi.post<ArrayBuffer>(
`/user/excel/download/${encodeURIComponent(slug[1])}`,
body,
{ expectBinary: true }
);
return new NextResponse(result, {
status: 200,
headers: {
"Content-Type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"Content-Disposition": `attachment; filename="user_${slug[1]}.xlsx"`,
},
});
}
return NextResponse.json({ message: "Not found" }, { status: 404 });
} catch (error: unknown) {
return errorToResponse(error);