less-logs-auth
All checks were successful
deploy / deploy (push) Successful in 1m25s

This commit is contained in:
Untone 2023-12-17 15:27:26 +03:00
parent 49fe665d4d
commit 5bac172cce
2 changed files with 12 additions and 6 deletions

View File

@ -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)

View File

@ -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