This commit is contained in:
parent
fc58208bdd
commit
9c6a349cc7
|
@ -185,19 +185,18 @@ def get_author_followers(_, _info, slug: str):
|
||||||
logger.debug(f'getting followers for @{slug}')
|
logger.debug(f'getting followers for @{slug}')
|
||||||
try:
|
try:
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
|
author_alias = aliased(Author)
|
||||||
author_id_result = (
|
author_id_result = (
|
||||||
session.query(Author.id).filter(Author.slug == slug).first()
|
session.query(author_alias.id).filter(author_alias.slug == slug).first()
|
||||||
)
|
)
|
||||||
author_id = author_id_result[0] if author_id_result else None
|
author_id = author_id_result[0] if author_id_result else None
|
||||||
|
|
||||||
author_alias = aliased(Author)
|
|
||||||
author_follower_alias = aliased(AuthorFollower, name='af')
|
author_follower_alias = aliased(AuthorFollower, name='af')
|
||||||
|
q = select(Author).join(
|
||||||
q = select(author_alias).join(
|
|
||||||
author_follower_alias,
|
author_follower_alias,
|
||||||
and_(
|
and_(
|
||||||
author_follower_alias.author == author_id,
|
author_follower_alias.author == author_id,
|
||||||
author_follower_alias.follower == author_alias.id,
|
author_follower_alias.follower == Author.id,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user