import { prisma } from "@/lib/db"; type Params = { params: Promise<{ chapterId: string }> }; export async function GET(_request: Request, { params }: Params) { const { chapterId: raw } = await params; const chapterId = parseInt(raw, 10); if (isNaN(chapterId)) { return Response.json({ error: "Invalid chapterId" }, { status: 400 }); } const pages = await prisma.page.findMany({ where: { chapterId }, orderBy: { number: "asc" }, select: { number: true, width: true, height: true }, }); return Response.json(pages); }