21 lines
651 B
TypeScript
21 lines
651 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");
|
|
}
|