This commit is contained in:
parent
49fe665d4d
commit
5bac172cce
|
@ -94,7 +94,11 @@ async def get_my_followed(_, info):
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
author = session.query(Author).filter(Author.user == user_id).first()
|
author = session.query(Author).filter(Author.user == user_id).first()
|
||||||
if author:
|
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)
|
topics_query = select(Topic).join(TopicFollower).filter(TopicFollower.follower == author.id)
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,8 @@ async def check_auth(req) -> (bool, int | None):
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.post(AUTH_URL, json=gql, headers=headers) as response:
|
async with session.post(AUTH_URL, json=gql, headers=headers) as response:
|
||||||
# Logging the GraphQL response
|
# Logging the GraphQL response
|
||||||
response_text = await response.text()
|
# response_text = await response.text()
|
||||||
print(f"[services.auth] GraphQL Response: {response_text}")
|
# print(f"[services.auth] GraphQL Response: {response_text}")
|
||||||
|
|
||||||
if response.status == 200:
|
if response.status == 200:
|
||||||
# Parsing JSON response
|
# Parsing JSON response
|
||||||
|
@ -48,14 +48,16 @@ async def check_auth(req) -> (bool, int | None):
|
||||||
|
|
||||||
if user_id:
|
if user_id:
|
||||||
# Logging the retrieved 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
|
return True, user_id
|
||||||
else:
|
else:
|
||||||
# Logging when no user ID is found in the response
|
# 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:
|
else:
|
||||||
# Logging when the request to the authentication server fails
|
# 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:
|
except Exception as e:
|
||||||
# Handling and logging exceptions during authentication check
|
# Handling and logging exceptions during authentication check
|
||||||
|
|
Loading…
Reference in New Issue
Block a user