feat(orion): extend report layout settings to version 1.1

This commit is contained in:
Schubert Ferenc 2026-07-12 14:56:15 +02:00
parent 12e1761a5b
commit 613ffdc8b7
591 changed files with 3601 additions and 999 deletions

View file

@ -0,0 +1,33 @@
import { cookies } from "next/headers";
import { NextRequest, NextResponse } from "next/server";
import { AUTH_COOKIE_NAME } from "@/lib/auth";
const mercuryBase = `${process.env.MERCURY_INTERNAL_URL ?? "http://mercury-api:8000"}/api/v1`;
export async function POST(request: NextRequest) {
const cookieStore = await cookies();
const token = cookieStore.get(AUTH_COOKIE_NAME)?.value;
if (!token) {
return NextResponse.json({ detail: "Not authenticated" }, { status: 401 });
}
const response = await fetch(`${mercuryBase}/report-settings/preview`, {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json"
},
body: await request.text(),
cache: "no-store"
});
const contentType = response.headers.get("content-type") ?? "application/pdf";
if (!response.ok && contentType.includes("application/json")) {
return NextResponse.json(await response.json(), { status: response.status });
}
return new NextResponse(response.body, {
status: response.status,
headers: {
"content-type": contentType,
"content-disposition": response.headers.get("content-disposition") ?? 'attachment; filename="orion-layout-preview.pdf"'
}
});
}