mirror of
https://github.com/BEDOLAGA-DEV/remnawave-bedolaga-telegram-bot.git
synced 2026-04-28 16:50:08 +00:00
Revert "Fix user search when numeric query exceeds INT32 range"
This commit is contained in:
@@ -26,8 +26,6 @@ from app.utils.validators import sanitize_telegram_name
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
INT32_MAX = 2_147_483_647
|
||||
|
||||
|
||||
def generate_referral_code() -> str:
|
||||
alphabet = string.ascii_letters + string.digits
|
||||
@@ -540,10 +538,8 @@ async def get_users_list(
|
||||
]
|
||||
|
||||
if search.isdigit():
|
||||
search_int = int(search)
|
||||
conditions.append(User.telegram_id == search_int)
|
||||
if search_int <= INT32_MAX:
|
||||
conditions.append(User.id == search_int) # Add support for searching by internal user ID
|
||||
conditions.append(User.telegram_id == int(search))
|
||||
conditions.append(User.id == int(search)) # Add support for searching by internal user ID
|
||||
|
||||
query = query.where(or_(*conditions))
|
||||
|
||||
@@ -640,10 +636,8 @@ async def get_users_count(
|
||||
]
|
||||
|
||||
if search.isdigit():
|
||||
search_int = int(search)
|
||||
conditions.append(User.telegram_id == search_int)
|
||||
if search_int <= INT32_MAX:
|
||||
conditions.append(User.id == search_int) # Add support for searching by internal user ID
|
||||
conditions.append(User.telegram_id == int(search))
|
||||
conditions.append(User.id == int(search)) # Add support for searching by internal user ID
|
||||
|
||||
query = query.where(or_(*conditions))
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@ from ..schemas.users import (
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
INT32_MAX = 2_147_483_647
|
||||
|
||||
|
||||
def _serialize_promo_group(group: Optional[PromoGroup]) -> Optional[PromoGroupSummary]:
|
||||
if not group:
|
||||
@@ -105,10 +103,8 @@ def _apply_search_filter(query, search: str):
|
||||
]
|
||||
|
||||
if search.isdigit():
|
||||
search_int = int(search)
|
||||
conditions.append(User.telegram_id == search_int)
|
||||
if search_int <= INT32_MAX:
|
||||
conditions.append(User.id == search_int)
|
||||
conditions.append(User.telegram_id == int(search))
|
||||
conditions.append(User.id == int(search))
|
||||
|
||||
return query.where(or_(*conditions))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user