Skip to content

Commit 476fe17

Browse files
committed
fix return type of getPodcastByChat handler
1 parent 031e5db commit 476fe17

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

surfsense_backend/app/routes/podcasts_routes.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def iterfile():
290290
) from e
291291

292292

293-
@router.get("/podcasts/by-chat/{chat_id}", response_model=PodcastRead)
293+
@router.get("/podcasts/by-chat/{chat_id}", response_model=PodcastRead | None)
294294
async def get_podcast_by_chat_id(
295295
chat_id: int,
296296
session: AsyncSession = Depends(get_async_session),
@@ -305,12 +305,6 @@ async def get_podcast_by_chat_id(
305305
)
306306
podcast = result.scalars().first()
307307

308-
if not podcast:
309-
raise HTTPException(
310-
status_code=404,
311-
detail="Podcast not found or you don't have permission to access it",
312-
)
313-
314308
return podcast
315309
except HTTPException as he:
316310
raise he

surfsense_web/hooks/use-podcast.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function usePodcast() {
1919
throw new Error(errorData.detail || "Failed to fetch podcast");
2020
}
2121

22-
return (await response.json()) as PodcastItem;
22+
return (await response.json()) as PodcastItem | null;
2323
} catch (err: any) {
2424
console.error("Error fetching podcast:", err);
2525
throw err;

0 commit comments

Comments
 (0)