From 087f6a7157d82d6d8987f08917aa2fbdbe0e293a Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 7 Aug 2024 13:47:10 +0300 Subject: [PATCH] shouts-distinc-topics-authors-fix --- resolvers/reader.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resolvers/reader.py b/resolvers/reader.py index 48582c31..d3f1fd56 100644 --- a/resolvers/reader.py +++ b/resolvers/reader.py @@ -49,6 +49,7 @@ def query_shouts(): ).label("rating_stat"), func.max(aliased_reaction.created_at).label("last_reacted_at"), array_agg( + func.distinct( func.json_build_object( "id", Author.id, @@ -59,8 +60,10 @@ def query_shouts(): "pic", Author.pic, ) + ) ).label("authors"), array_agg( + func.distinct( func.json_build_object( "id", Topic.id, @@ -71,6 +74,7 @@ def query_shouts(): "slug", Topic.slug, ) + ) ).label("topics"), ) .outerjoin(aliased_reaction, aliased_reaction.shout == Shout.id)