feat: astro test

This commit is contained in:
trafficlunar 2026-04-16 22:32:08 +01:00
parent df6e31ba89
commit 84144c383c
262 changed files with 18993 additions and 2655 deletions

View file

@ -0,0 +1,20 @@
import { redirect } from "next/navigation";
import { prisma } from "@/lib/prisma";
export const dynamic = "force-dynamic";
export default async function RandomPage() {
const count = await prisma.mii.count();
if (count === 0) redirect("/");
const randomIndex = Math.floor(Math.random() * count);
const randomMii = await prisma.mii.findFirst({
where: { in_queue: false, quarantined: false },
skip: randomIndex,
take: 1,
select: { id: true },
});
if (!randomMii) redirect(process.env.NEXT_PUBLIC_FRONTEND_URL || "http://localhost:4321");
redirect(`${process.env.NEXT_PUBLIC_FRONTEND_URL}/mii/${randomMii.id}`);
}