felhasználói felületre pü
This commit is contained in:
@@ -573,16 +573,22 @@ class AtomicTransactionManager:
|
||||
# Convert to dictionary format
|
||||
transactions = []
|
||||
for entry in ledger_entries:
|
||||
# Extract description from JSONB details field (legacy compatibility)
|
||||
desc = None
|
||||
if entry.details and isinstance(entry.details, dict):
|
||||
desc = entry.details.get("description") or entry.details.get("desc") or None
|
||||
elif entry.details and isinstance(entry.details, str):
|
||||
desc = entry.details
|
||||
transactions.append({
|
||||
"id": entry.id,
|
||||
"user_id": entry.user_id,
|
||||
"amount": float(entry.amount),
|
||||
"entry_type": entry.entry_type.value,
|
||||
"wallet_type": entry.wallet_type.value if entry.wallet_type else None,
|
||||
"description": entry.description,
|
||||
"description": desc,
|
||||
"transaction_id": str(entry.transaction_id),
|
||||
"reference_type": entry.reference_type,
|
||||
"reference_id": entry.reference_id,
|
||||
"reference_type": None,
|
||||
"reference_id": None,
|
||||
"balance_after": float(entry.balance_after) if entry.balance_after else None,
|
||||
"created_at": entry.created_at.isoformat() if entry.created_at else None
|
||||
})
|
||||
@@ -622,15 +628,15 @@ class AtomicTransactionManager:
|
||||
return {
|
||||
"wallet_id": wallet.id,
|
||||
"balances": {
|
||||
"earned": float(wallet.earned_credits),
|
||||
"purchased": float(wallet.purchased_credits),
|
||||
"service_coins": float(wallet.service_coins),
|
||||
"voucher": float(voucher_balance),
|
||||
"earned": float(wallet.earned_credits or 0),
|
||||
"purchased": float(wallet.purchased_credits or 0),
|
||||
"service_coins": float(wallet.service_coins or 0),
|
||||
"voucher": float(voucher_balance or 0),
|
||||
"total": float(
|
||||
wallet.earned_credits +
|
||||
wallet.purchased_credits +
|
||||
wallet.service_coins +
|
||||
voucher_balance
|
||||
(wallet.earned_credits or 0) +
|
||||
(wallet.purchased_credits or 0) +
|
||||
(wallet.service_coins or 0) +
|
||||
(voucher_balance or 0)
|
||||
)
|
||||
},
|
||||
"recent_transactions": recent_transactions,
|
||||
|
||||
Reference in New Issue
Block a user