From 839453dc8d66bc1854f19753d0f892aa3357cfe2 Mon Sep 17 00:00:00 2001 From: thierryverse Date: Mon, 27 Oct 2025 22:10:11 +0200 Subject: [PATCH] fix return type of getPodcastByChat handler --- surfsense_backend/app/routes/podcasts_routes.py | 8 +------- surfsense_web/hooks/use-podcast.ts | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/surfsense_backend/app/routes/podcasts_routes.py b/surfsense_backend/app/routes/podcasts_routes.py index 1772917eb..98ea7b84f 100644 --- a/surfsense_backend/app/routes/podcasts_routes.py +++ b/surfsense_backend/app/routes/podcasts_routes.py @@ -289,7 +289,7 @@ async def stream_podcast( ) from e -@router.get("/podcasts/by-chat/{chat_id}", response_model=PodcastRead) +@router.get("/podcasts/by-chat/{chat_id}", response_model=PodcastRead | None) async def get_podcast_by_chat_id( chat_id: int, session: AsyncSession = Depends(get_async_session), @@ -304,12 +304,6 @@ async def get_podcast_by_chat_id( ) podcast = result.scalars().first() - if not podcast: - raise HTTPException( - status_code=404, - detail="Podcast not found or you don't have permission to access it", - ) - return podcast except HTTPException as he: raise he diff --git a/surfsense_web/hooks/use-podcast.ts b/surfsense_web/hooks/use-podcast.ts index d84db268b..461572333 100644 --- a/surfsense_web/hooks/use-podcast.ts +++ b/surfsense_web/hooks/use-podcast.ts @@ -19,7 +19,7 @@ export function usePodcast() { throw new Error(errorData.detail || "Failed to fetch podcast"); } - return (await response.json()) as PodcastItem; + return (await response.json()) as PodcastItem | null; } catch (err: any) { console.error("Error fetching podcast:", err); throw err;