Built via two parallel agent workflows reading the real Prisma schema, then integrated + verified. Public: /shop (categories + storefront), /community hub, /rankings (top by credits), /staff, /photos (camera_web gallery), /help (categories + rules), /help/tickets (auth-gated user tickets + create), /settings (auth-gated, update motto via RCON). Admin: /admin/catalog (+[id] items), /admin/radio (shouts/apps/schedules + delete shout), /admin/teams (CRUD), /admin/permissions (read), /admin/wordfilter (CRUD + RCON push), /admin/ip (whitelist/blacklist CRUD), /admin/applications (list + dismiss), /admin/logs (chat/command/alert read), /admin/achievements (read). Server actions all staff-gated. Header + admin nav extended. Verified: tsc exit 0, vitest 48/48, next build exit 0 (33 routes); curl-probed every route — public 200/<main>, auth+admin correctly 307-redirect when unauthorized.
28 lines
604 B
TypeScript
28 lines
604 B
TypeScript
'use server';
|
|
|
|
import { revalidatePath } from 'next/cache';
|
|
import { prisma } from '@/lib/prisma';
|
|
import { requireStaff } from '@/lib/admin/guard';
|
|
|
|
export async function deleteShout(formData: FormData): Promise<void> {
|
|
await requireStaff();
|
|
|
|
const raw = formData.get('id');
|
|
if (typeof raw !== 'string' || raw.trim() === '') return;
|
|
|
|
let id: bigint;
|
|
try {
|
|
id = BigInt(raw);
|
|
} catch {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
await prisma.radioShouts.delete({ where: { id } });
|
|
} catch {
|
|
// Row may already be gone; ignore so the action does not throw.
|
|
}
|
|
|
|
revalidatePath('/admin/radio');
|
|
}
|