This commit is contained in:
parent
ea5b9e5b09
commit
5cccaf43f7
|
@ -95,21 +95,18 @@ async def get_my_followed(_, info):
|
||||||
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 = (
|
authors_query = (
|
||||||
select(Author)
|
select(Author).join(AuthorFollower).filter(AuthorFollower.follower == author.id).from_(Author)
|
||||||
.join(AuthorFollower, AuthorFollower.author == 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).from_(Author)
|
||||||
|
|
||||||
communities_query = (
|
communities_query = (
|
||||||
select(Community)
|
select(Community).join(CommunityAuthor).filter(CommunityAuthor.author == author.id).from_(Author)
|
||||||
.join(CommunityAuthor, CommunityAuthor.author == Author.id)
|
|
||||||
.filter(CommunityAuthor.author == author.id)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
topics = [t for [t] in session.execute(topics_query)]
|
topics = session.execute(topics_query).scalars().all()
|
||||||
authors = [a for [a] in session.execute(authors_query)]
|
authors = session.execute(authors_query).scalars().all()
|
||||||
communities = [c for [c] in session.execute(communities_query)]
|
communities = session.execute(communities_query).scalars().all()
|
||||||
|
|
||||||
return {"topics": topics, "authors": authors, "communities": communities}
|
return {"topics": topics, "authors": authors, "communities": communities}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user