nitpicking vlad :)

This commit is contained in:
dni ⚡ 2022-12-20 13:44:14 +01:00
parent 29869cfcda
commit 36ae851a8d
2 changed files with 8 additions and 12 deletions

View File

@ -53,7 +53,7 @@ async def get_usermanager_user(user_id: str) -> Optional[User]:
return User(**row) if row else None
async def get_usermanager_users(user_id: str) -> list[User]:
async def get_usermanager_users(user_id: str) -> List[User]:
rows = await db.fetchall(
"SELECT * FROM usermanager.users WHERE admin = ?", (user_id,)
)
@ -94,21 +94,21 @@ async def get_usermanager_wallet(wallet_id: str) -> Optional[Wallet]:
return Wallet(**row) if row else None
async def get_usermanager_wallets(admin_id: str) -> list[Wallet]:
async def get_usermanager_wallets(admin_id: str) -> List[Wallet]:
rows = await db.fetchall(
"SELECT * FROM usermanager.wallets WHERE admin = ?", (admin_id,)
)
return [Wallet(**row) for row in rows]
async def get_usermanager_users_wallets(user_id: str) -> list[Wallet]:
async def get_usermanager_users_wallets(user_id: str) -> List[Wallet]:
rows = await db.fetchall(
"""SELECT * FROM usermanager.wallets WHERE "user" = ?""", (user_id,)
)
return [Wallet(**row) for row in rows]
async def get_usermanager_wallet_transactions(wallet_id: str) -> list[Payment]:
async def get_usermanager_wallet_transactions(wallet_id: str) -> List[Payment]:
return await get_payments(
wallet_id=wallet_id, complete=True, pending=False, outgoing=True, incoming=True
)

View File

@ -21,7 +21,7 @@ from .crud import (
get_usermanager_wallet_transactions,
get_usermanager_wallets,
)
from .models import CreateUserData, CreateUserWallet, Wallet
from .models import CreateUserData, CreateUserWallet
@usermanager_ext.get("/api/v1/users", status_code=HTTPStatus.OK)
@ -32,14 +32,10 @@ async def api_usermanager_users(
return [user.dict() for user in await get_usermanager_users(user_id)]
@usermanager_ext.get("/api/v1/users/{user_id}", status_code=HTTPStatus.OK)
async def api_usermanager_user(
user_id, wallet: WalletTypeInfo = Depends(get_key_type) # type: ignore
):
@usermanager_ext.get("/api/v1/users/{user_id}", status_code=HTTPStatus.OK, dependencies=[Depends(get_key_type)])
async def api_usermanager_user(user_id):
user = await get_usermanager_user(user_id)
if not user:
return None
return user.dict()
return user.dict() if user else None
@usermanager_ext.post(