Security (launch blockers): - src/middleware.ts (edge): forwards x-pathname + real client IP. - access-guard.ts (Node, from root layout): routes non-staff to /maintenance when maintenance mode is on, banned users to /banned. New /banned + /maintenance pages (the consumers the admin toggle was missing). Admin layout enforces force_staff_2fa before /admin. - staff-activity.ts audit log wired into ban/lift/give-currency/set-rank actions. Infra (parallel agents): alert service (alert_logs + Discord embed + email), PayPal top-up (create/capture API routes + /shop/topup), cron worker (scripts/jobs-worker.ts via croner: emulator-ping->alert, maintenance-check, bans-cleanup), social connections page, admin radio settings/banners/ranks. Public radio subsystem: /radio (+schedule, shouts+post, contests, giveaways, apply, leaderboard) and /apply/staff + /apply/team submission forms. Radio nav link added. .env.example documents the new optional vars. (radio song-requests dropped: its table is a stub in AtomCMS — columns added by un-modeled alter-migrations.) Verified: tsc exit 0, vitest 48/48, next build exit 0 (82 page routes).
59 lines
1.5 KiB
TypeScript
59 lines
1.5 KiB
TypeScript
import Link from "next/link";
|
|
import { notFound } from "next/navigation";
|
|
import { prisma } from "@/lib/prisma";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
function formatDate(d: Date | null | undefined): string {
|
|
return d ? d.toISOString().slice(0, 19).replace("T", " ") : "";
|
|
}
|
|
|
|
export default async function RadioGiveawayDetailPage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ id: string }>;
|
|
}) {
|
|
const { id } = await params;
|
|
|
|
// Route param is a string; RadioGiveaways.id is a BigInt. Guard against a
|
|
// non-numeric id before constructing the BigInt (would otherwise throw).
|
|
let giveawayId: bigint;
|
|
try {
|
|
giveawayId = BigInt(id);
|
|
} catch {
|
|
notFound();
|
|
}
|
|
|
|
const giveaway = await prisma.radioGiveaways
|
|
.findUnique({ where: { id: giveawayId! } })
|
|
.catch(() => null);
|
|
|
|
if (!giveaway) notFound();
|
|
|
|
const giveawayIdStr = giveaway.id.toString();
|
|
|
|
return (
|
|
<main>
|
|
<p className="muted" style={{ margin: "0 0 0.5rem" }}>
|
|
<Link href="/radio/giveaways">← Back to giveaways</Link>
|
|
</p>
|
|
|
|
<div className="card">
|
|
<h1 style={{ margin: "0 0 0.5rem" }}>Giveaway #{giveawayIdStr}</h1>
|
|
<table>
|
|
<tbody>
|
|
<tr>
|
|
<th>Created</th>
|
|
<td>{formatDate(giveaway.createdAt) || <span className="muted">—</span>}</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Updated</th>
|
|
<td>{formatDate(giveaway.updatedAt) || <span className="muted">—</span>}</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</main>
|
|
);
|
|
}
|