Add draw_animation_seconds config and expose winner info during a round

RoundConfig gains draw_animation_seconds (default 20) — the minimum
time the frontend's "estrazione in corso" animation plays before
revealing a winner. It's purely a UI cue: the real draw still waits for
a confirmed block for its entropy (rounds/scheduler.py), which usually
takes much longer than this value, so it only ever extends the
animation, never truncates the real wait.

GET /rounds/current now also returns draw_animation_seconds,
winner_user_id and winner_amount_sats (all populated once the
scheduler sets them on the round, i.e. from "paying_out" onward) so a
client can determine and reveal the outcome. GET /users/me now returns
the user's own id, needed client-side to compare against winner_user_id.

Admin config CRUD refactored to a shared field tuple (_CONFIG_FIELDS)
instead of repeating the same 7-then-8 field list three times.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-21 16:04:02 +02:00
co-authored by Claude Sonnet 5
parent b52a8023de
commit 669c3fb714
5 changed files with 71 additions and 20 deletions
+4 -1
View File
@@ -8,6 +8,7 @@ router = APIRouter(prefix="/users", tags=["users"])
class MeResponse(BaseModel):
id: int
username: str
address: str
balance_sats: int
@@ -15,4 +16,6 @@ class MeResponse(BaseModel):
@router.get("/me", response_model=MeResponse)
async def me(user: User = Depends(get_current_user)) -> MeResponse:
return MeResponse(username=user.username, address=user.address, balance_sats=user.cached_balance_sats)
return MeResponse(
id=user.id, username=user.username, address=user.address, balance_sats=user.cached_balance_sats
)