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>
22 lines
555 B
Python
22 lines
555 B
Python
from fastapi import APIRouter, Depends
|
|
from pydantic import BaseModel
|
|
|
|
from app.auth.dependencies import get_current_user
|
|
from app.db.models import User
|
|
|
|
router = APIRouter(prefix="/users", tags=["users"])
|
|
|
|
|
|
class MeResponse(BaseModel):
|
|
id: int
|
|
username: str
|
|
address: str
|
|
balance_sats: int
|
|
|
|
|
|
@router.get("/me", response_model=MeResponse)
|
|
async def me(user: User = Depends(get_current_user)) -> MeResponse:
|
|
return MeResponse(
|
|
id=user.id, username=user.username, address=user.address, balance_sats=user.cached_balance_sats
|
|
)
|