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]>
34 lines
746 B
TypeScript
34 lines
746 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 deleteSoundtrack({ id }: { id: number }) {
|
|
await requirePermission(PERMS.CATALOG_EDIT);
|
|
await prisma.soundtracks.delete({ where: { id } });
|
|
revalidatePath("/admin/sounds");
|
|
}
|
|
|
|
export async function updateSoundtrack({
|
|
id,
|
|
name,
|
|
author,
|
|
track,
|
|
length,
|
|
}: {
|
|
id: number;
|
|
name: string;
|
|
author: string;
|
|
track: string;
|
|
length: number;
|
|
}) {
|
|
await requirePermission(PERMS.CATALOG_EDIT);
|
|
await prisma.soundtracks.update({
|
|
where: { id },
|
|
data: { name, author, track, length },
|
|
});
|
|
revalidatePath("/admin/sounds");
|
|
}
|