feat(games): add steam pages with steam price/reduc
This commit is contained in:
@@ -3,7 +3,8 @@ from typing import List
|
||||
from ninja import Router
|
||||
|
||||
from .models import Game
|
||||
from .schemas import GameOut
|
||||
from .schemas import GameOut, SteamGameOut
|
||||
from .tasks import schedule_steam_refresh
|
||||
|
||||
router = Router()
|
||||
event_router = Router()
|
||||
@@ -17,3 +18,13 @@ def list_games(request):
|
||||
@event_router.get("/events/{event_path}/games", response=List[GameOut])
|
||||
def list_event_games(request, event_path: str):
|
||||
return Game.objects.enabled_for_event(request.event)
|
||||
|
||||
|
||||
@event_router.get("/events/{event_path}/games/steam", response=List[SteamGameOut])
|
||||
def list_event_steam_games(request, event_path: str):
|
||||
"""The event's Steam games with their store info (price, discount, blurb)."""
|
||||
# Safety net in case the periodic refresh loop isn't running (no-op otherwise).
|
||||
schedule_steam_refresh()
|
||||
return Game.objects.enabled_for_event(request.event).filter(
|
||||
steam_app_id__isnull=False
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user