formatting

This commit is contained in:
dni ⚡ 2022-12-20 13:18:37 +01:00
parent 22cafe9ed0
commit 29869cfcda
2 changed files with 21 additions and 11 deletions

View File

@ -10,8 +10,7 @@ from . import usermanager_ext, usermanager_renderer
@usermanager_ext.get("/", response_class=HTMLResponse)
async def index(
request: Request,
user: User = Depends(check_user_exists) #type: ignore
request: Request, user: User = Depends(check_user_exists) # type: ignore
):
return usermanager_renderer().TemplateResponse(
"usermanager/index.html", {"request": request, "user": user.dict()}

View File

@ -26,7 +26,7 @@ from .models import CreateUserData, CreateUserWallet, Wallet
@usermanager_ext.get("/api/v1/users", status_code=HTTPStatus.OK)
async def api_usermanager_users(
wallet: WalletTypeInfo = Depends(require_admin_key) #type: ignore
wallet: WalletTypeInfo = Depends(require_admin_key), # type: ignore
):
user_id = wallet.wallet.user
return [user.dict() for user in await get_usermanager_users(user_id)]
@ -34,8 +34,7 @@ async def api_usermanager_users(
@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
user_id, wallet: WalletTypeInfo = Depends(get_key_type) # type: ignore
):
user = await get_usermanager_user(user_id)
if not user:
@ -43,7 +42,11 @@ async def api_usermanager_user(
return user.dict()
@usermanager_ext.post("/api/v1/users", status_code=HTTPStatus.CREATED, dependencies=[Depends(get_key_type)])
@usermanager_ext.post(
"/api/v1/users",
status_code=HTTPStatus.CREATED,
dependencies=[Depends(get_key_type)],
)
async def api_usermanager_users_create(data: CreateUserData):
user = await create_usermanager_user(data)
full = user.dict()
@ -53,7 +56,9 @@ async def api_usermanager_users_create(data: CreateUserData):
return full
@usermanager_ext.delete("/api/v1/users/{user_id}", dependencies=[Depends(require_admin_key)])
@usermanager_ext.delete(
"/api/v1/users/{user_id}", dependencies=[Depends(require_admin_key)]
)
async def api_usermanager_users_delete(
user_id,
delete_core: bool = Query(True),
@ -96,25 +101,31 @@ async def api_usermanager_wallets_create(data: CreateUserWallet):
@usermanager_ext.get("/api/v1/wallets")
async def api_usermanager_wallets(
wallet: WalletTypeInfo = Depends(require_admin_key) #type: ignore
wallet: WalletTypeInfo = Depends(require_admin_key), # type: ignore
):
admin_id = wallet.wallet.user
return [wallet.dict() for wallet in await get_usermanager_wallets(admin_id)]
@usermanager_ext.get("/api/v1/transactions/{wallet_id}", dependencies=[Depends(get_key_type)])
@usermanager_ext.get(
"/api/v1/transactions/{wallet_id}", dependencies=[Depends(get_key_type)]
)
async def api_usermanager_wallet_transactions(wallet_id):
return await get_usermanager_wallet_transactions(wallet_id)
@usermanager_ext.get("/api/v1/wallets/{user_id}", dependencies=[Depends(require_admin_key)])
@usermanager_ext.get(
"/api/v1/wallets/{user_id}", dependencies=[Depends(require_admin_key)]
)
async def api_usermanager_users_wallets(user_id):
return [
s_wallet.dict() for s_wallet in await get_usermanager_users_wallets(user_id)
]
@usermanager_ext.delete("/api/v1/wallets/{wallet_id}", dependencies=[Depends(require_admin_key)])
@usermanager_ext.delete(
"/api/v1/wallets/{wallet_id}", dependencies=[Depends(require_admin_key)]
)
async def api_usermanager_wallets_delete(wallet_id):
get_wallet = await get_usermanager_wallet(wallet_id)
if not get_wallet: