kin: BATON-BIZ-001-backend_dev

This commit is contained in:
Gros Frumos 2026-03-21 12:42:13 +02:00
parent e266b6506e
commit ea06309a6e
5 changed files with 160 additions and 1 deletions

View file

@ -352,6 +352,30 @@ async def update_registration_status(reg_id: int, status: str) -> bool:
return changed
async def get_registration_by_login_or_email(login_or_email: str) -> Optional[dict]:
async with _get_conn() as conn:
async with conn.execute(
"""
SELECT id, email, login, password_hash, status, push_subscription, created_at
FROM registrations
WHERE login = ? OR email = ?
""",
(login_or_email, login_or_email),
) as cur:
row = await cur.fetchone()
if row is None:
return None
return {
"id": row["id"],
"email": row["email"],
"login": row["login"],
"password_hash": row["password_hash"],
"status": row["status"],
"push_subscription": row["push_subscription"],
"created_at": row["created_at"],
}
async def save_telegram_batch(
message_text: str,
signals_count: int,