// @wikiCategory: Lieder import { NextResponse } from "next/server"; import { removeSongfromSongbook } from "@/lib/db/managing"; // @wikiDescription: Lied von einem Liederbuch entfernen export async function POST(request: Request) { try { const body = await request.json(); const { songId, songbookId } = body; if (isNaN(songId) || isNaN(songbookId)) { return NextResponse.json( { error: "Ungültige IDs." }, { status: 400 } ); } const result = await removeSongfromSongbook( Number(songId), Number(songbookId) ); if (result.success) { return NextResponse.json( { message: "Lied erfolgreich aus dem Liederbuch gelöscht!" }, { status: 200 } ); } else { return NextResponse.json( { error: "Fehler beim Löschen aus dem Liederbuch." }, { status: 500 } ); } } catch (error) { console.error("API Error in /api/songs/remove:", error); return NextResponse.json( { error: "Ungültiges JSON oder Serverfehler." }, { status: 500 } ); } }