From 8d7339b9509b4b5bbd51e2b6565ebc28c899094c Mon Sep 17 00:00:00 2001 From: fullsizemalt <106900403+fullsizemalt@users.noreply.github.com> Date: Tue, 30 Dec 2025 19:38:19 -0800 Subject: [PATCH] fix(shows): fix venue visibility and song filtering - Added eager loading of venue and tour to shows API endpoints to fix 'Unknown Venue' display - Fixed query param -> in getTopSongs to correctly filter suggested songs --- backend/routers/shows.py | 18 +++++++++++++++--- frontend/app/[vertical]/page.tsx | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/backend/routers/shows.py b/backend/routers/shows.py index f8948fa..40c96a7 100644 --- a/backend/routers/shows.py +++ b/backend/routers/shows.py @@ -49,7 +49,11 @@ def read_shows( session: Session = Depends(get_session) ): from sqlalchemy.orm import joinedload - query = select(Show).options(joinedload(Show.vertical)) + query = select(Show).options( + joinedload(Show.vertical), + joinedload(Show.venue), + joinedload(Show.tour) + ) if tiers and current_user: prefs = session.exec( @@ -106,7 +110,11 @@ def read_recent_shows( """Get the most recent shows ordered by date descending""" from datetime import datetime from sqlalchemy.orm import joinedload - query = select(Show).options(joinedload(Show.vertical)).where(Show.date <= datetime.now()) + query = select(Show).options( + joinedload(Show.vertical), + joinedload(Show.venue), + joinedload(Show.tour) + ).where(Show.date <= datetime.now()) if tiers and current_user: prefs = session.exec( @@ -133,7 +141,11 @@ def read_upcoming_shows( """Get upcoming shows ordered by date ascending""" from datetime import datetime from sqlalchemy.orm import joinedload - query = select(Show).options(joinedload(Show.vertical)).where(Show.date > datetime.now()) + query = select(Show).options( + joinedload(Show.vertical), + joinedload(Show.venue), + joinedload(Show.tour) + ).where(Show.date > datetime.now()) if tiers and current_user: prefs = session.exec( diff --git a/frontend/app/[vertical]/page.tsx b/frontend/app/[vertical]/page.tsx index 7aa4750..ae5fdb4 100644 --- a/frontend/app/[vertical]/page.tsx +++ b/frontend/app/[vertical]/page.tsx @@ -31,7 +31,7 @@ async function getRecentShows(verticalSlug: string) { async function getTopSongs(verticalSlug: string) { try { - const res = await fetch(`${getApiUrl()}/songs/?vertical_slug=${verticalSlug}&limit=5&sort=times_played`, { + const res = await fetch(`${getApiUrl()}/songs/?vertical=${verticalSlug}&limit=5&sort=times_played`, { next: { revalidate: 60 } }) if (!res.ok) return []