feat: сеть (network) для крипто-холдингов

Свободное текстовое поле на холдинге — какой сети принадлежит конкретная
монета (Ethereum, Tron и т.д.), с редактированием прямо в таблице и
разбивкой % по сетям на отдельной вкладке. Помогает увидеть, что часть
стейблкоинов лежит на рискованных сетях и стоит перевести на безопасные.
This commit is contained in:
ZProger
2026-09-09 00:52:11 +03:00
parent 526bfe104d
commit c3047c6d6a
16 changed files with 421 additions and 13 deletions

View File

@@ -6,6 +6,7 @@ from app.schemas.crypto import (
CryptoHistoryResponse,
CryptoHoldingCreate,
CryptoHoldingRead,
CryptoHoldingUpdate,
CryptoPerformanceResponse,
CryptoPortfolioCreate,
CryptoPortfolioRead,
@@ -29,6 +30,7 @@ from app.services.crypto_service import (
list_transactions,
refresh_prices,
search_coins,
update_holding,
update_portfolio,
update_transaction,
)
@@ -89,6 +91,15 @@ async def create_holding_route(
return await create_holding(session, payload)
@router.patch("/holdings/{asset_id}", response_model=CryptoHoldingRead)
async def update_holding_route(
asset_id: int, payload: CryptoHoldingUpdate, session: AsyncSession = Depends(get_session)
) -> CryptoHoldingRead:
"""Updates holding-only metadata (currently just `network`) — quantity/
price/date go through the /transactions routes below instead."""
return await update_holding(session, asset_id, payload)
@router.post("/holdings/{asset_id}/transactions", response_model=CryptoHoldingRead, status_code=201)
async def add_transaction_route(
asset_id: int, payload: CryptoTransactionCreate, session: AsyncSession = Depends(get_session)