refactor: code cleanup

This commit is contained in:
Vlad Stan
2026-02-02 16:29:35 +02:00
parent c7398f6314
commit 46ebb6ce27
2 changed files with 2 additions and 19 deletions
-18
View File
@@ -38,24 +38,6 @@ async def update_account(account: Account, conn: Connection | None = None) -> Ac
return account
async def update_account_activation(
user_id: str, activated: bool, conn: Connection | None = None
) -> None:
await (conn or db).execute(
f"""
UPDATE accounts
SET activated = :activated, updated_at = {db.timestamp_placeholder('now')}
WHERE id = :user_id
""", # noqa: S608
{
"activated": activated,
"now": int(time()),
"user_id": user_id,
},
)
await clear_user_id_cache(user_id)
async def delete_account(user_id: str, conn: Connection | None = None) -> None:
await (conn or db).execute(
"DELETE from accounts WHERE id = :user",
+2 -1
View File
@@ -20,7 +20,7 @@ from lnbits.core.crud import (
update_admin_settings,
update_wallet,
)
from lnbits.core.crud.users import get_account, update_account
from lnbits.core.crud.users import clear_user_id_cache, get_account, update_account
from lnbits.core.crud.wallets import delete_wallet_by_id
from lnbits.core.models import (
AccountFilters,
@@ -250,6 +250,7 @@ async def api_users_toggle_activated(
)
user_account.activated = not user_account.activated
await update_account(user_account)
await clear_user_id_cache(user_id)
return SimpleStatus(
success=True,