This commit is contained in:
parent
5cccaf43f7
commit
49fe665d4d
|
@ -166,7 +166,8 @@ async def get_author_id(_, _info, user: str):
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
print(f"[resolvers.author] getting author id for {user}")
|
print(f"[resolvers.author] getting author id for {user}")
|
||||||
a = session.query(Author).filter(Author.user == user).first()
|
a = session.query(Author).filter(Author.user == user).first()
|
||||||
print(f"[resolvers.author] got {a}")
|
if a:
|
||||||
|
print(f"[resolvers.author] got @{a.slug}")
|
||||||
return a
|
return a
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -94,19 +94,15 @@ 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 = (
|
authors_query = select(Author).join(AuthorFollower).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).from_(Author)
|
topics_query = select(Topic).join(TopicFollower).filter(TopicFollower.follower == author.id)
|
||||||
|
|
||||||
communities_query = (
|
# communities_query = select(Community).join(CommunityAuthor).filter(CommunityAuthor.author == author.id)
|
||||||
select(Community).join(CommunityAuthor).filter(CommunityAuthor.author == author.id).from_(Author)
|
|
||||||
)
|
|
||||||
|
|
||||||
topics = session.execute(topics_query).scalars().all()
|
topics = session.execute(topics_query).scalars().all()
|
||||||
authors = session.execute(authors_query).scalars().all()
|
authors = session.execute(authors_query).scalars().all()
|
||||||
communities = session.execute(communities_query).scalars().all()
|
communities = session.query(Community).scalars().all()
|
||||||
|
|
||||||
return {"topics": topics, "authors": authors, "communities": communities}
|
return {"topics": topics, "authors": authors, "communities": communities}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user