fix(shows): fix venue visibility and song filtering
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s
- 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
This commit is contained in:
parent
6d3b30ed6f
commit
8d7339b950
2 changed files with 16 additions and 4 deletions
|
|
@ -49,7 +49,11 @@ def read_shows(
|
||||||
session: Session = Depends(get_session)
|
session: Session = Depends(get_session)
|
||||||
):
|
):
|
||||||
from sqlalchemy.orm import joinedload
|
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:
|
if tiers and current_user:
|
||||||
prefs = session.exec(
|
prefs = session.exec(
|
||||||
|
|
@ -106,7 +110,11 @@ def read_recent_shows(
|
||||||
"""Get the most recent shows ordered by date descending"""
|
"""Get the most recent shows ordered by date descending"""
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from sqlalchemy.orm import joinedload
|
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:
|
if tiers and current_user:
|
||||||
prefs = session.exec(
|
prefs = session.exec(
|
||||||
|
|
@ -133,7 +141,11 @@ def read_upcoming_shows(
|
||||||
"""Get upcoming shows ordered by date ascending"""
|
"""Get upcoming shows ordered by date ascending"""
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from sqlalchemy.orm import joinedload
|
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:
|
if tiers and current_user:
|
||||||
prefs = session.exec(
|
prefs = session.exec(
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ async function getRecentShows(verticalSlug: string) {
|
||||||
|
|
||||||
async function getTopSongs(verticalSlug: string) {
|
async function getTopSongs(verticalSlug: string) {
|
||||||
try {
|
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 }
|
next: { revalidate: 60 }
|
||||||
})
|
})
|
||||||
if (!res.ok) return []
|
if (!res.ok) return []
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue