Files
kolaytercih/src/app/api/netler/route.ts
bilalgursen e62c6f07df
Some checks failed
Deploy / deploy (push) Failing after 1h28m6s
Update package.json scripts, enhance layout with new components, and improve API error handling
- Added new scripts for database operations and temporary production in package.json.
- Integrated KaydetBannerLazy component into the layout for improved user notifications.
- Enhanced API error handling in the soru route to mark credit exhaustion.
- Updated the IletisimPage for better button styling and user experience.
- Refactored ListemPage to streamline user flow and improve session handling.
- Removed unused ListePaneli component to clean up the codebase.
2026-08-06 02:27:42 +03:00

20 lines
732 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { NextResponse, type NextRequest } from "next/server";
import { netlerGetir } from "@/lib/db";
// Program satırındaki "netler" butonunun verisi: programa yerleşen son
// kişinin yıl bazlı netleri (bkz. components/program-netleri.tsx). Veri
// yılda bir değiştiği için istemci tarafında gönül rahatlığıyla cache'lenir.
export function GET(request: NextRequest) {
const id = request.nextUrl.searchParams.get("id") ?? "";
if (!/^\d{1,12}$/.test(id)) {
return NextResponse.json(
{ error: "Geçerli bir program kimliği gerekli." },
{ status: 400 },
);
}
return NextResponse.json(
{ netler: netlerGetir(id) },
{ headers: { "Cache-Control": "public, max-age=86400" } },
);
}