33 lines
652 B
TypeScript
33 lines
652 B
TypeScript
"use server";
|
|
|
|
import { revalidatePath } from "next/cache";
|
|
import { requireStaff } from "@/lib/admin/guard";
|
|
import { prisma } from "@/lib/prisma";
|
|
|
|
export async function deleteSoundtrack({ id }: { id: number }) {
|
|
await requireStaff();
|
|
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 requireStaff();
|
|
await prisma.soundtracks.update({
|
|
where: { id },
|
|
data: { name, author, track, length },
|
|
});
|
|
revalidatePath("/admin/sounds");
|
|
}
|