feat: add extensive test suite

This commit is contained in:
2026-08-30 11:33:53 +07:00 Unverified
parent 061cce00dc
commit 8359c7272e
131 changed files with 8717 additions and 2200 deletions
+4 -14
View File
@@ -2,21 +2,11 @@ import { eq } from "drizzle-orm";
import { notFound } from "next/navigation";
import { db } from "@/lib/db";
import { cdn } from "@/lib/db/schema";
import { createCdnHandler } from "@/lib/server-handlers";
export const dynamic = "force-dynamic";
export async function GET(
_req: Request,
{ params }: { params: Promise<{ id: string }> },
) {
const { id } = await params;
export const GET = createCdnHandler(async (id) => {
const [file] = await db.select().from(cdn).where(eq(cdn.id, id)).limit(1);
if (!file) return notFound();
return new Response(new Uint8Array(file.data), {
headers: {
"Content-Type": file.type,
"Content-Length": file.size,
"Cache-Control": "public, max-age=31536000, immutable",
},
});
}
return file ? { ...file, data: new Uint8Array(file.data) } : null;
}, notFound);