yiekheng 4f5d74e1c8 Squashed 'manga-site/' content from commit f2ef775
git-subtree-dir: manga-site
git-subtree-split: f2ef775f7095dc2b107b576cd4053593e89dd887
2026-04-12 18:47:51 +08:00

20 lines
550 B
TypeScript

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);
}