import { auth } from "@/lib/auth"; import { prisma } from "@/lib/prisma"; export const dynamic = "force-dynamic"; const FAR_FUTURE = Math.floor(Date.now() / 1000) + 50 * 365 * 24 * 3600; export default async function BannedPage() { const session = await auth(); let reason = ""; let expire = 0; if (session?.user?.id) { try { const now = Math.floor(Date.now() / 1000); const ban = await prisma.ban.findFirst({ where: { userId: Number(session.user.id), banExpire: { gt: now } }, orderBy: { banExpire: "desc" }, select: { banReason: true, banExpire: true }, }); if (ban) { reason = ban.banReason; expire = ban.banExpire; } } catch { // show generic message } } const expiryText = expire === 0 ? "" : expire > FAR_FUTURE ? "This ban is permanent." : `Expires ${new Date(expire * 1000).toISOString().slice(0, 16).replace("T", " ")}.`; return (

You are banned

Your account has been suspended from the hotel.

{reason ? (

Reason: {reason}

) : null} {expiryText ?

{expiryText}

: null}

If you believe this is a mistake, contact the staff team.

); }