diff --git a/backend/main.py b/backend/main.py index 3681dd1..fea8a2b 100644 --- a/backend/main.py +++ b/backend/main.py @@ -38,3 +38,9 @@ app.include_router(stats.router) @app.get("/") def read_root(): return {"Hello": "World"} + +@app.get("/healthz") +def health_check(): + """Health check endpoint for monitoring and load balancers""" + return {"status": "healthy"} + diff --git a/backend/seed_ratings.py b/backend/seed_ratings.py new file mode 100644 index 0000000..f51c7c6 --- /dev/null +++ b/backend/seed_ratings.py @@ -0,0 +1,64 @@ +""" +Seed script to create demo ratings for shows and performances. +Run with: python seed_ratings.py +""" +from sqlmodel import Session, create_engine, select +from database import DATABASE_URL +from models import Rating, Show, Performance, User +import random + +def seed_ratings(): + engine = create_engine(DATABASE_URL) + + with Session(engine) as session: + # Get first user (or admin) to attribute ratings to + user = session.exec(select(User).limit(1)).first() + if not user: + print("No users found. Please create a user first.") + return + + # Get some shows + shows = session.exec(select(Show).limit(20)).all() + # Get some performances + performances = session.exec(select(Performance).limit(50)).all() + + created_count = 0 + + # Seed show ratings (7-10 range for positive feel) + for show in shows: + # Check if rating already exists + existing = session.exec( + select(Rating).where(Rating.show_id == show.id, Rating.user_id == user.id) + ).first() + if existing: + continue + + rating = Rating( + user_id=user.id, + show_id=show.id, + score=random.randint(7, 10) + ) + session.add(rating) + created_count += 1 + + # Seed performance ratings + for perf in performances: + existing = session.exec( + select(Rating).where(Rating.performance_id == perf.id, Rating.user_id == user.id) + ).first() + if existing: + continue + + rating = Rating( + user_id=user.id, + performance_id=perf.id, + score=random.randint(6, 10) + ) + session.add(rating) + created_count += 1 + + session.commit() + print(f"Created {created_count} demo ratings!") + +if __name__ == "__main__": + seed_ratings() diff --git a/frontend/components/layout/navbar.tsx b/frontend/components/layout/navbar.tsx index 4695ffa..0e705a8 100644 --- a/frontend/components/layout/navbar.tsx +++ b/frontend/components/layout/navbar.tsx @@ -48,10 +48,7 @@ export function Navbar() { Tours - - - Leaderboards - + {/* Leaderboards hidden until community activity grows */}