"use server";

import { prisma } from "@/lib/prisma";
import { revalidatePath } from "next/cache";

export async function deleteComment(id: string) {
  try {
    await prisma.comment.delete({
      where: { id },
    });
    revalidatePath("/comments");
    revalidatePath("/dashboard");
    return { success: true };
  } catch (error) {
    console.error("Failed to delete comment:", error);
    return { success: false, error: "Erreur lors de la suppression" };
  }
}
