some-more-queries-fix-3

This commit is contained in:
Untone 2023-10-13 14:07:13 +03:00
parent d881f9da27
commit 1b7aa6aa0a

View File

@ -89,7 +89,7 @@ async def user_subscriptions(user_id: int):
user_id user_id
), # unread inbox messages counter ), # unread inbox messages counter
"topics": [ "topics": [
t.slug for t in await followed_topics(user_id) t.slug for t in followed_topics(user_id)
], # followed topics slugs ], # followed topics slugs
"authors": [ "authors": [
a.slug for a in await followed_authors(user_id) a.slug for a in await followed_authors(user_id)
@ -126,7 +126,7 @@ async def get_followed_topics(_, info, slug) -> List[Topic]:
if user_id is None: if user_id is None:
raise ValueError("User not found") raise ValueError("User not found")
return await followed_topics(user_id) return followed_topics(user_id)
# dufok mod (^*^') : # dufok mod (^*^') :
@ -159,6 +159,8 @@ async def author_followers(_, info, author_id: int, limit: int = 20, offset: int
q.join(AuthorFollower, AuthorFollower.follower == User.id) q.join(AuthorFollower, AuthorFollower.follower == User.id)
.join(aliased_user, aliased_user.id == AuthorFollower.author) .join(aliased_user, aliased_user.id == AuthorFollower.author)
.where(aliased_user.id == author_id) .where(aliased_user.id == author_id)
.limit(limit)
.offset(offset)
) )
return get_authors_from_query(q) return get_authors_from_query(q)