260625_01_ENH: 연구, 실사 수정사항 적용 1차

This commit is contained in:
2026-06-25 13:05:37 +09:00
parent 8e3c4302c5
commit 29dd9d628e
15 changed files with 197 additions and 65 deletions

View File

@@ -2,7 +2,7 @@ import {NextRequest, NextResponse} from "next/server";
import {RouteContext} from "@/types/common";
import {errorToResponse} from "@/lib/http-util";
import {createBackApi} from "@/lib/server-api";
import {PerformanceCompact} from "@/types/gwcf";
import {PerformanceCompact, PerformanceFull} from "@/types/gwcf";
const ALLOWED_ORIGIN = "https://kon.kric.com";
@@ -73,6 +73,11 @@ export const POST = async (
return withCors(NextResponse.json(result, { status: 200 }));
}
if(action === "performance" && slug.length === 2) {
const result = await backApi.get<PerformanceFull>(`/performance/${encodeURIComponent(slug[1])}`)
return withCors(NextResponse.json(result, { status: 200 }));
}
if(action === "performance-list") {
const result = await backApi.get<PerformanceCompact[]>(`/performance/list/compact`)
return withCors(NextResponse.json(result, { status: 200 }));

View File

@@ -19,10 +19,10 @@ export const GET = async (
const [action, second, third, fourth] = slug;
const backApi = await createBackApi();
if (action === "template" && second === "download" && third && slug.length === 3) {
if (action === "template" && second === "download" && third && fourth && slug.length === 4) {
const cookieStore = await cookies();
const accessToken = cookieStore.get(CookieKeys.AuthToken)?.value;
const response = await fetch(`${serverEnv.API_BACK_SERVER.replace(/\/+$/, "")}/review/template/download/${encodeURIComponent(third)}`, {
const response = await fetch(`${serverEnv.API_BACK_SERVER.replace(/\/+$/, "")}/review/template/download/${encodeURIComponent(third)}/${encodeURIComponent(fourth)}`, {
headers: accessToken ? {authorization: `Bearer ${accessToken}`} : undefined,
cache: "no-store",
});
@@ -43,6 +43,21 @@ export const GET = async (
});
}
if (action === "template" && second === "pdf" && third && fourth && slug.length === 4) {
const result = await backApi.get<ArrayBuffer>(
`/review/pdf/download/${encodeURIComponent(third)}/${encodeURIComponent(fourth)}`,
{ expectBinary: true }
);
const disposition = req.nextUrl.searchParams.get("disposition") === "inline" ? "inline" : "attachment";
return new NextResponse(result, {
status: 200,
headers: {
"Content-Type": "application/pdf",
"Content-Disposition": `${disposition}; filename="review-template-${third}-${fourth}.pdf"`,
},
});
}
if (action === "download" && second && third && fourth && slug.length === 4) {
const result = await backApi.get<ArrayBuffer>(
`/review/download/${encodeURIComponent(second)}/${encodeURIComponent(third)}/${encodeURIComponent(fourth)}`,