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)