import { renderMedalSvg } from "@/lib/medals"; import { loadOwnedSponsorship } from "../../_lib/owner"; import { notFoundResponse, privateFileResponse } from "../../_lib/http"; import { downloadNames } from "../../_lib/bundle"; import { sponsorshipMedalInput } from "../../_lib/medal"; /** Patenschafts-Medaille als Vektor (SVG, Text als Pfade) — immer als Download, nie inline. */ export async function GET(_request: Request, { params }: { params: Promise<{ id: string }> }) { const owned = await loadOwnedSponsorship((await params).id); if (!owned?.sponsorship.revision) return notFoundResponse(); const svg = renderMedalSvg(sponsorshipMedalInput(owned.sponsorship)); return privateFileResponse(svg, { contentType: "image/svg+xml; charset=utf-8", downloadName: downloadNames(owned.sponsorship).svg, }); }