refactors

This commit is contained in:
counterweight 2025-12-25 00:59:57 +01:00
parent 139a5fbef3
commit f46d2ae8b3
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
12 changed files with 734 additions and 536 deletions

View file

@ -277,3 +277,64 @@ class ConstantsResponse(BaseModel):
roles: list[str]
invite_statuses: list[InviteStatus]
bitcoin_transfer_methods: list[BitcoinTransferMethod]
# =============================================================================
# Exchange Price/Config Schemas
# =============================================================================
class ExchangeConfigResponse(BaseModel):
"""Exchange configuration for the frontend."""
eur_min: int
eur_max: int
eur_increment: int
premium_percentage: int
class PriceResponse(BaseModel):
"""Current BTC/EUR price for trading.
Note: The actual agreed price depends on trade direction (buy/sell)
and is calculated by the frontend using market_price and premium_percentage.
"""
market_price: float # Raw price from exchange
premium_percentage: int
timestamp: datetime
is_stale: bool
class ExchangePriceResponse(BaseModel):
"""Combined price and configuration response."""
price: PriceResponse | None # None if price fetch failed
config: ExchangeConfigResponse
error: str | None = None
class BookableSlot(BaseModel):
"""A single bookable time slot."""
start_time: datetime
end_time: datetime
class AvailableSlotsResponse(BaseModel):
"""Response containing available slots for a date."""
date: date
slots: list[BookableSlot]
# =============================================================================
# Admin User Search Schemas
# =============================================================================
class UserSearchResult(BaseModel):
"""Result item for user search."""
id: int
email: str