From d0890347dc999b41ea6daf20ee3ab38b604ad392 Mon Sep 17 00:00:00 2001 From: Mayo Date: Fri, 31 Jul 2026 10:46:35 +0200 Subject: [PATCH] AI comments cleanup --- lib/db/songbooksongs.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/db/songbooksongs.ts b/lib/db/songbooksongs.ts index 3bfb064..bda9dc4 100644 --- a/lib/db/songbooksongs.ts +++ b/lib/db/songbooksongs.ts @@ -17,7 +17,7 @@ export async function addSongToBook(songId: number, bookId: number, songNumber: return { success: false, error: "Songnumber already taken in this songbook" }; } - const entry = await prisma.songBook.create({ // Verknüpfungs-Tabelle + const entry = await prisma.songBook.create({ data: { songId, bookId, @@ -49,13 +49,11 @@ export async function addSongToBook(songId: number, bookId: number, songNumber: */ export async function updateSongInBook(songId: number, bookId: number, data: {songNumber: number}) { try { - // 1. Prüfen, ob die neue Nummer bereits vergeben ist const isTaken = await isSongNumberTaken(bookId, data.songNumber); if (isTaken) { return { success: false, error: "New song number is already taken in this songbook" }; } - // 2. Eintrag über den Composite Primary Key (songId_bookId) aktualisieren const entry = await prisma.songBook.update({ where: { songId_bookId: { @@ -75,12 +73,12 @@ export async function updateSongInBook(songId: number, bookId: number, data: {so return { success: true, entry }; } catch (error: any) { - // P2025 = Record to update not found (Verknüpfung existiert noch gar nicht) + // P2025 = Record to update not found if (error?.code === "P2025") { return { success: false, error: "Song is not assigned to this songbook" }; } - // P2002 = Unique Constraint Violation (z.B. neue Nummer doch schon besetzt) + // P2002 = Unique Constraint Violation if (error?.code === "P2002") { return { success: false, error: "Song number already exists in this songbook" }; }