feat: click a coin row to view its trade history; edit transactions

Matches CoinMarketCap's flow: clicking anywhere on a coin's row in the
holdings table opens its transaction history (previously only a dedicated
icon button did). The table's own History icon is gone since the row now
does that job; the remaining "+"/delete icons get stopPropagation so they
don't also trigger the row click.

Adds the missing piece: transactions could be viewed and deleted but not
edited. New PATCH /crypto/transactions/{id} (partial update, never calls
CoinGecko, same oversell guard as creating a sell) backs a pencil button on
each history row that opens CryptoTransactionModal pre-filled — the same
dialog used for "+", now doing double duty as create/edit.

86/86 backend tests passing (4 new). Verified live against the real API:
create, edit quantity/note, 404 on unknown id, cleanup — real user data
untouched throughout.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01855PiW5Wd8n4aRW4n9kByY
This commit is contained in:
ZProger
2026-08-30 05:06:20 +03:00
parent dc9421e08a
commit c3309b9d60
12 changed files with 238 additions and 45 deletions

View File

@@ -19,6 +19,14 @@ class CryptoTransactionCreate(BaseModel):
note: str | None = Field(default=None, max_length=500)
class CryptoTransactionUpdate(BaseModel):
type: CryptoTransactionType | None = None
quantity: Decimal | None = Field(default=None, gt=0, max_digits=38, decimal_places=18)
price_per_unit: Decimal | None = Field(default=None, gt=0, max_digits=38, decimal_places=18)
date: date_ | None = None
note: str | None = Field(default=None, max_length=500)
class CryptoTransactionRead(BaseModel):
model_config = ConfigDict(from_attributes=True)