From 5bac172cce42d430adf51f86573f274e7f9aeebd Mon Sep 17 00:00:00 2001 From: Untone Date: Sun, 17 Dec 2023 15:27:26 +0300 Subject: [PATCH] less-logs-auth --- resolvers/follower.py | 6 +++++- services/auth.py | 12 +++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/resolvers/follower.py b/resolvers/follower.py index 778927fe..9bd1123c 100644 --- a/resolvers/follower.py +++ b/resolvers/follower.py @@ -94,7 +94,11 @@ async def get_my_followed(_, info): with local_session() as session: author = session.query(Author).filter(Author.user == user_id).first() if author: - authors_query = select(Author).join(AuthorFollower).filter(AuthorFollower.follower == author.id) + authors_query = ( + select(Author) + .join(AuthorFollower, AuthorFollower.follower == Author.id) + .filter(AuthorFollower.follower == author.id) + ) topics_query = select(Topic).join(TopicFollower).filter(TopicFollower.follower == author.id) diff --git a/services/auth.py b/services/auth.py index 3457ed4f..25f39b12 100644 --- a/services/auth.py +++ b/services/auth.py @@ -34,8 +34,8 @@ async def check_auth(req) -> (bool, int | None): async with aiohttp.ClientSession() as session: async with session.post(AUTH_URL, json=gql, headers=headers) as response: # Logging the GraphQL response - response_text = await response.text() - print(f"[services.auth] GraphQL Response: {response_text}") + # response_text = await response.text() + # print(f"[services.auth] GraphQL Response: {response_text}") if response.status == 200: # Parsing JSON response @@ -48,14 +48,16 @@ async def check_auth(req) -> (bool, int | None): if user_id: # Logging the retrieved user ID - print(f"[services.auth] User ID retrieved: {user_id}") + # print(f"[services.auth] User ID retrieved: {user_id}") return True, user_id else: # Logging when no user ID is found in the response - print("[services.auth] No user ID found in the response") + # print("[services.auth] No user ID found in the response") + pass else: # Logging when the request to the authentication server fails - print(f"[services.auth] Request failed with status: {response.status}") + # print(f"[services.auth] Request failed with status: {response.status}") + pass except Exception as e: # Handling and logging exceptions during authentication check