backwards compatible

This commit is contained in:
dni ⚡
2024-10-10 09:08:02 +02:00
parent 0779535a9c
commit 3551ee14a4
+10 -2
View File
@@ -1,7 +1,7 @@
import json import json
from datetime import datetime from datetime import datetime
from time import time from time import time
from typing import Literal, Optional from typing import Literal, Optional, Union
from uuid import uuid4 from uuid import uuid4
import shortuuid import shortuuid
@@ -220,7 +220,15 @@ async def get_account_by_username_or_email(
) )
async def get_user(account: Account, conn: Optional[Connection] = None) -> User: async def get_user(
account_or_id: Union[Account, str], conn: Optional[Connection] = None
) -> Optional[User]:
if isinstance(account_or_id, str):
account = await get_account(account_or_id, conn)
if not account:
return None
else:
account = account_or_id
extensions = await get_user_active_extensions_ids(account.id, conn) extensions = await get_user_active_extensions_ids(account.id, conn)
wallets = await get_wallets(account.id, conn) wallets = await get_wallets(account.id, conn)
return User( return User(