From 4adf3d5a1e40f40335ee1c6a82f2cbb7524b814c Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 14 Nov 2024 01:32:00 +0300 Subject: [PATCH] unrated-fix3 --- resolvers/reader.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resolvers/reader.py b/resolvers/reader.py index 93b7ce91..dcaabc7a 100644 --- a/resolvers/reader.py +++ b/resolvers/reader.py @@ -442,7 +442,12 @@ async def load_shouts_unrated(_, info, options): q = ( select(Shout) .where(and_(Shout.published_at.is_not(None), Shout.deleted_at.is_(None))) - .join(Author, Author.id == Shout.created_by) + ) + q = q.join(Author, Author.id == Shout.created_by) + q = q.add_columns( + json_builder( + "id", Author.id, "name", Author.name, "slug", Author.slug, "pic", Author.pic + ).label("main_author") ) q = q.join(ShoutTopic, and_(ShoutTopic.shout == Shout.id, ShoutTopic.main.is_(True))) q = q.join(Topic, Topic.id == ShoutTopic.topic)