fix return type of getPodcastByChat handler

This commit is contained in:
thierryverse 2025-10-27 22:10:11 +02:00
parent ce4bb7e1b7
commit 839453dc8d
2 changed files with 2 additions and 8 deletions

View file

@ -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

View file

@ -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;