backwards compatible

This commit is contained in:
dni ⚡ 2024-09-29 22:44:29 +02:00 committed by Vlad Stan
parent 7828e134df
commit 2ee7b8951d

View File

@ -1,7 +1,7 @@
import json
from datetime import datetime
from time import time
from typing import Literal, Optional
from typing import Literal, Optional, Union
from uuid import uuid4
import shortuuid
@ -236,7 +236,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)
wallets = await get_wallets(account.id, conn)
return User(