get-my-followed-fix-2
This commit is contained in:
parent
4320c9674c
commit
7b5330625b
|
@ -104,14 +104,18 @@ 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:
|
||||||
aliased_authors = aliased(Author)
|
author_id = int(author.id)
|
||||||
|
|
||||||
authors_query = (
|
authors_query = (
|
||||||
session.query(aliased_authors)
|
session.query(Author)
|
||||||
.join(AuthorFollower, AuthorFollower.follower == author.id)
|
.join(AuthorFollower, AuthorFollower.follower == author_id)
|
||||||
.filter(AuthorFollower.author == aliased_authors.id)
|
.filter(AuthorFollower.author == Author.id)
|
||||||
|
)
|
||||||
|
|
||||||
|
topics_query = (
|
||||||
|
session.query(Topic)
|
||||||
|
.join(TopicFollower, TopicFollower.follower == author_id)
|
||||||
)
|
)
|
||||||
topics_query = select(Topic).join(TopicFollower, TopicFollower.follower == Author.id)
|
|
||||||
|
|
||||||
for [author] in session.execute(authors_query):
|
for [author] in session.execute(authors_query):
|
||||||
authors.append(author)
|
authors.append(author)
|
||||||
|
@ -124,6 +128,7 @@ async def get_my_followed(_, info):
|
||||||
return {"topics": topics, "authors": authors, "communities": communities}
|
return {"topics": topics, "authors": authors, "communities": communities}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@query.field("get_shout_followers")
|
@query.field("get_shout_followers")
|
||||||
def get_shout_followers(_, _info, slug: str = "", shout_id: int | None = None) -> List[Author]:
|
def get_shout_followers(_, _info, slug: str = "", shout_id: int | None = None) -> List[Author]:
|
||||||
followers = []
|
followers = []
|
||||||
|
|
Loading…
Reference in New Issue
Block a user