From 25f4589512ab318639bdc3494b2cee54f4d2d053 Mon Sep 17 00:00:00 2001 From: Alexandre Teles Date: Thu, 5 Jan 2023 20:52:02 -0300 Subject: [PATCH 1/2] fix(auth): await on async method --- app/routers/auth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/routers/auth.py b/app/routers/auth.py index ee51230..3610a40 100644 --- a/app/routers/auth.py +++ b/app/routers/auth.py @@ -39,7 +39,7 @@ async def auth(request: Request, response: Response, client: ClientModels.Client } ) else: - if not ballot.exists(client.discord_id_hash): + if not await ballot.exists(client.discord_id_hash): user_claims: dict[str, str] = {} user_claims['discord_id_hash'] = client.discord_id_hash access_token = Authorize.create_access_token(subject=client.id, @@ -75,7 +75,7 @@ async def exchange_token(request: Request, response: Response, Authorize: AuthPA access_token = Authorize.create_access_token(subject=Authorize.get_subject(), user_claims=user_claims, fresh=True) - if not ballot.exists(Authorize.get_subject()): + if not await ballot.exists(Authorize.get_subject()): if await clients.ban_token(Authorize.get_jti()): return {"access_token": access_token} else: From 802163ae382dd4a58c7a3bbd1c19c7ae775241a7 Mon Sep 17 00:00:00 2001 From: Alexandre Teles Date: Thu, 5 Jan 2023 20:54:26 -0300 Subject: [PATCH 2/2] fix(ballot): fix ballot model --- app/models/ResponseModels.py | 2 +- app/routers/ballot.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/ResponseModels.py b/app/models/ResponseModels.py index c7b77f8..e3140bf 100644 --- a/app/models/ResponseModels.py +++ b/app/models/ResponseModels.py @@ -38,4 +38,4 @@ class BallotCastedResponse(BaseModel): BaseModel (pydantic.BaseModel): BaseModel from pydantic """ - casted: bool + cast: bool diff --git a/app/routers/ballot.py b/app/routers/ballot.py index 2899f67..00a1ad0 100644 --- a/app/routers/ballot.py +++ b/app/routers/ballot.py @@ -41,7 +41,7 @@ async def cast_ballot(request: Request, response: Response, if stored: await client.ban_token(Authorize.get_jti()) - return {"created": stored} + return {"cast": stored} else: raise HTTPException(status_code=500, detail={ "error": GeneralErrors.InternalServerError().error,