From 602d40be5975b85d0cf45532922a388f0daaf674 Mon Sep 17 00:00:00 2001 From: justuser-31 Date: Fri, 7 Nov 2025 22:52:31 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B1=D0=B0=D0=B3=D0=B0:=20await=20?= =?UTF-8?q?token=5Fcheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- user_api/user_api.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/user_api/user_api.py b/user_api/user_api.py index ded59c4..f6e29bf 100644 --- a/user_api/user_api.py +++ b/user_api/user_api.py @@ -81,7 +81,7 @@ async def get_user_token_info_api( user_token: str = Body(), session: AsyncSession = Depends(get_session) ): - if not token_check(username, user_token): + if not await token_check(username, user_token): raise HTTPException(status_code=401, detail='Invalid username or token') user_token_db = await user_token_in_db_func(session, user_token) if not user_token_db: @@ -97,7 +97,7 @@ async def user_in_db_api( user_token: str = Body(), session: AsyncSession = Depends(get_session) ): - if not token_check(username, user_token): + if not await token_check(username, user_token): raise HTTPException(status_code=401, detail='Invalid username or token') await log(session, user_token, f'/user_in_db') return await user_in_db(token=SYSTEM_API_TOKEN, username=username) @@ -110,7 +110,7 @@ async def transfer_coins_api( amount: float = Body(), session: AsyncSession = Depends(get_session) ): - if not token_check(username, user_token): + if not await token_check(username, user_token): raise HTTPException(status_code=401, detail='Invalid username or token') await log(session, user_token, f'/transfer_coins: (dst_username: {dst_username}, amount: {amount})') return await transfer_coins(token=SYSTEM_API_TOKEN, src_username=username @@ -122,7 +122,7 @@ async def get_stats_api( user_token: str = Body(), session: AsyncSession = Depends(get_session) ): - if not token_check(username, user_token): + if not await token_check(username, user_token): raise HTTPException(status_code=401, detail='Invalid username or token') await log(session, user_token, f'/get_stats') return await get_stats(token=SYSTEM_API_TOKEN) @@ -134,7 +134,7 @@ async def create_invoice_api( amount: float | None = Body(None), session: AsyncSession = Depends(get_session) ): - if not token_check(username, user_token): + if not await token_check(username, user_token): raise HTTPException(status_code=401, detail='Invalid username or token') await log(session, user_token, f'/create_invoice: (amount: {amount})') return await create_invoice(token=SYSTEM_API_TOKEN, dst_username=username, amount=amount) @@ -146,7 +146,7 @@ async def delete_invoice_api( id: str = Body(), session: AsyncSession = Depends(get_session) ): - if not token_check(username, user_token): + if not await token_check(username, user_token): raise HTTPException(status_code=401, detail='Invalid username or token') await log(session, user_token, f'/delete_invoice: (id: {id})') return await delete_invoice(token=SYSTEM_API_TOKEN, id=id) @@ -158,7 +158,7 @@ async def get_invoice_api( id: str = Body(), session: AsyncSession = Depends(get_session) ): - if not token_check(username, user_token): + if not await token_check(username, user_token): raise HTTPException(status_code=401, detail='Invalid username or token') await log(session, user_token, f'/get_invoice: (id: {id})') return await get_invoice(token=SYSTEM_API_TOKEN, id=id)