From 7879b63498fc6e1a759b34c14b9260ba9b01eb23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=B6rdle=20Bot?= Date: Thu, 4 Dec 2025 00:57:02 +0100 Subject: [PATCH] fix: TypeScript-Fehler in batch route korrigiert - Verwende lokale Variable curatorAssignments statt nullable assignments - TypeScript erkennt jetzt korrekt, dass die Variable nicht null ist --- app/api/songs/batch/route.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api/songs/batch/route.ts b/app/api/songs/batch/route.ts index 3f3583a..890f103 100644 --- a/app/api/songs/batch/route.ts +++ b/app/api/songs/batch/route.ts @@ -81,12 +81,12 @@ export async function POST(request: Request) { let assignments: { genreIds: Set; specialIds: Set } | null = null; if (context.role === 'curator') { - assignments = await getCuratorAssignments(context.curator.id); + const curatorAssignments = await getCuratorAssignments(context.curator.id); + assignments = curatorAssignments; // Validate genre/special toggles are within curator's assignments - // assignments is guaranteed to be non-null here since we're in the curator block if (hasGenreToggle) { - const invalidGenre = genreToggleIds.some((id: number) => !assignments!.genreIds.has(id)); + const invalidGenre = genreToggleIds.some((id: number) => !curatorAssignments.genreIds.has(id)); if (invalidGenre) { return NextResponse.json( { error: 'Curators may only toggle their own genres' }, @@ -96,7 +96,7 @@ export async function POST(request: Request) { } if (hasSpecialToggle) { - const invalidSpecial = specialToggleIds.some((id: number) => !assignments!.specialIds.has(id)); + const invalidSpecial = specialToggleIds.some((id: number) => !curatorAssignments.specialIds.has(id)); if (invalidSpecial) { return NextResponse.json( { error: 'Curators may only toggle their own specials' },