following-fix-3
All checks were successful
deploy / deploy (push) Successful in 1m25s

This commit is contained in:
Untone 2023-12-17 15:15:08 +03:00
parent ea5b9e5b09
commit 5cccaf43f7

View File

@ -95,21 +95,18 @@ async def get_my_followed(_, info):
author = session.query(Author).filter(Author.user == user_id).first()
if author:
authors_query = (
select(Author)
.join(AuthorFollower, AuthorFollower.author == Author.id)
.filter(AuthorFollower.follower == author.id)
select(Author).join(AuthorFollower).filter(AuthorFollower.follower == author.id).from_(Author)
)
topics_query = select(Topic).join(TopicFollower).filter(TopicFollower.follower == author.id)
topics_query = select(Topic).join(TopicFollower).filter(TopicFollower.follower == author.id).from_(Author)
communities_query = (
select(Community)
.join(CommunityAuthor, CommunityAuthor.author == Author.id)
.filter(CommunityAuthor.author == author.id)
select(Community).join(CommunityAuthor).filter(CommunityAuthor.author == author.id).from_(Author)
)
topics = [t for [t] in session.execute(topics_query)]
authors = [a for [a] in session.execute(authors_query)]
communities = [c for [c] in session.execute(communities_query)]
topics = session.execute(topics_query).scalars().all()
authors = session.execute(authors_query).scalars().all()
communities = session.execute(communities_query).scalars().all()
return {"topics": topics, "authors": authors, "communities": communities}