From 04d918749f831a61bae2525a02384bf11c012890 Mon Sep 17 00:00:00 2001 From: Untone Date: Tue, 27 Feb 2024 16:52:11 +0300 Subject: [PATCH] get-followers-fix-2 --- resolvers/author.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/resolvers/author.py b/resolvers/author.py index 6986cdaf..4784e3ca 100644 --- a/resolvers/author.py +++ b/resolvers/author.py @@ -1,7 +1,7 @@ import json import time -from sqlalchemy import select, or_, and_, text, desc, cast, Integer +from sqlalchemy import select, or_, and_, text, desc from sqlalchemy.orm import aliased from sqlalchemy_searchable import search @@ -219,11 +219,7 @@ async def get_author_followers(_, _info, slug: str): try: with local_session() as session: author_alias = aliased(Author) - author_id_result = ( - session.query(author_alias).filter(author_alias.slug == slug).first() - ) - author = author_id_result[0] if author_id_result else None - author_id = cast(author.id, Integer) + author_id = session.query(author_alias).filter(author_alias.slug == slug).first() cached = await redis.execute('GET', f'id:{author_id}:followers') results = [] if not cached: