Local Build and Deploy / deploy (push) Successful in 56s
Replace leftover requireStaff gates with module PERMS, drop hardcoded room rank thresholds, and expand contract tests so admin mutations cannot regress to dashboard-only checks. Co-authored-by: Cursor <[email protected]>
21 lines
539 B
TypeScript
21 lines
539 B
TypeScript
"use server";
|
|
|
|
import { revalidatePath } from "next/cache";
|
|
import { requirePermission } from "@/lib/admin/guard";
|
|
import { PERMS } from "@/lib/permissions";
|
|
import { prisma } from "@/lib/prisma";
|
|
|
|
export async function deletePhoto(formData: FormData): Promise<void> {
|
|
await requirePermission(PERMS.PAGES_EDIT);
|
|
const id = Number(formData.get("id"));
|
|
if (!(id > 0)) return;
|
|
|
|
try {
|
|
await prisma.cameraWeb.delete({ where: { id } });
|
|
} catch {
|
|
// Record may have already been removed; ignore.
|
|
}
|
|
|
|
revalidatePath("/admin/photos");
|
|
}
|