19 lines
431 B
TypeScript
19 lines
431 B
TypeScript
import { db } from "@/db";
|
|
import { cdnImageResponse } from "@/lib/cdn/cdn-images";
|
|
|
|
export async function GET(
|
|
_request: Request,
|
|
{ params }: { params: Promise<{ id: string }> }
|
|
) {
|
|
const { id } = await params;
|
|
const record = await db.query.cdn.findFirst({
|
|
where: (cdn, { eq }) => eq(cdn.id, id),
|
|
});
|
|
|
|
if (!record) {
|
|
return new Response("Not found", { status: 404 });
|
|
}
|
|
|
|
return cdnImageResponse(record);
|
|
}
|