import { eq } from "drizzle-orm"; import { notFound, permanentRedirect } from "next/navigation"; import { db } from "@/lib/db/client"; import { models } from "@/lib/db/schema"; export const dynamic = "force-dynamic"; /** Old URL scheme (/models/): redirect to //. */ export default async function LegacyModelPage({ params }: PageProps<"/models/[id]">) { const { id } = await params; const model = await db().query.models.findFirst({ columns: { repoId: true }, where: eq(models.id, id) }); if (!model) notFound(); permanentRedirect(`/${model.repoId}`); }