fix: add email field to traffic table for OAuth/email users

Include user email in UserTrafficItem schema, search filter,
CSV export, and frontend display (shown below name when no
Telegram username exists).
This commit is contained in:
Fringg
2026-02-08 22:04:42 +03:00
parent 9d39901f78
commit 94fcf20d17
2 changed files with 9 additions and 1 deletions

View File

@@ -188,9 +188,14 @@ def _build_traffic_items(
full_name = user.full_name
username = user.username
email = user.email
if search_lower:
if search_lower not in (full_name or '').lower() and search_lower not in (username or '').lower():
if (
search_lower not in (full_name or '').lower()
and search_lower not in (username or '').lower()
and search_lower not in (email or '').lower()
):
continue
sub = user.subscription
@@ -225,6 +230,7 @@ def _build_traffic_items(
user_id=user.id,
telegram_id=user.telegram_id,
username=username,
email=email,
full_name=full_name,
tariff_name=tariff_name,
subscription_status=subscription_status,
@@ -593,6 +599,7 @@ async def export_traffic_csv(
'User ID': item.user_id,
'Telegram ID': item.telegram_id or '',
'Username': item.username or '',
'Email': item.email or '',
'Full Name': item.full_name,
'Tariff': item.tariff_name or '',
'Status': item.subscription_status or '',

View File

@@ -13,6 +13,7 @@ class UserTrafficItem(BaseModel):
user_id: int
telegram_id: int | None
username: str | None
email: str | None
full_name: str
tariff_name: str | None
subscription_status: str | None