d3bed34c6c
Bundles several sessions' worth of previously uncommitted work: map categories with Domination/Conquest/King of the Hill mode stubs and a server-list mode filter; a procedurally-drawn character-creation screen replacing the old callsign-only PROFILE overlay; the on-foot groundwork (walkable station hub, ship interior, character controller) plus the RAM currency backend; and today's addition, an in-ship Helldivers-2-style navigation table that QUICK PLAY's queue/connect flow and the Belters/ Military hub travel now live behind, with hub-and-ship return paths and a context-aware pause menu usable both in-match and inside the ship. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
27 lines
930 B
Python
27 lines
930 B
Python
from fastapi import APIRouter, Depends, HTTPException
|
|
from sqlalchemy import select
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.database import get_db
|
|
from app.models import Player
|
|
from app.schemas import PlayerStatsResponse
|
|
|
|
router = APIRouter(prefix="/stats", tags=["stats"])
|
|
|
|
|
|
@router.get("/{callsign}", response_model=PlayerStatsResponse)
|
|
async def get_stats(callsign: str, db: AsyncSession = Depends(get_db)) -> PlayerStatsResponse:
|
|
player = (await db.execute(select(Player).where(Player.callsign == callsign))).scalars().first()
|
|
if player is None:
|
|
raise HTTPException(status_code=404, detail="Player not found")
|
|
return PlayerStatsResponse(
|
|
callsign=player.callsign,
|
|
mmr=player.mmr,
|
|
wins=player.wins,
|
|
losses=player.losses,
|
|
kills=player.kills,
|
|
deaths=player.deaths,
|
|
hours_played=player.hours_played,
|
|
ram_kb=player.ram_kb,
|
|
)
|