feat: remove a skill category empty

This commit is contained in:
Julien Froidefond
2025-08-26 07:10:26 +02:00
parent e12816a9c2
commit d7fef0be9b
8 changed files with 176 additions and 4 deletions

View File

@@ -0,0 +1,39 @@
import { NextRequest, NextResponse } from "next/server";
import { AdminService } from "@/services/admin-service";
export async function DELETE(
request: NextRequest,
{ params }: { params: { categoryId: string } }
) {
try {
const { categoryId } = params;
if (!categoryId) {
return NextResponse.json(
{ error: "ID de catégorie requis" },
{ status: 400 }
);
}
await AdminService.deleteSkillCategory(categoryId);
return NextResponse.json(
{ message: "Catégorie supprimée avec succès" },
{ status: 200 }
);
} catch (error) {
console.error("Erreur lors de la suppression de la catégorie:", error);
if (error instanceof Error) {
return NextResponse.json(
{ error: error.message },
{ status: 400 }
);
}
return NextResponse.json(
{ error: "Erreur interne du serveur" },
{ status: 500 }
);
}
}