// app/api/files/route.js import { NextResponse } from "next/server"; import { listFiles } from "@/lib/storage"; export async function GET(request) { const { searchParams } = new URL(request.url); const branch = searchParams.get("branch"); const year = searchParams.get("year"); const month = searchParams.get("month"); const day = searchParams.get("day"); if (!branch || !year || !month || !day) { return NextResponse.json( { error: "branch, year, month, day sind erforderlich" }, { status: 400 } ); } try { const files = await listFiles(branch, year, month, day); return NextResponse.json({ branch, year, month, day, files }); } catch (error) { console.error("[api/files] Fehler:", error); return NextResponse.json( { error: "Fehler beim Lesen der Dateien" }, { status: 500 } ); } }