shouts-distinc-topics-authors-fix
Some checks failed
Deploy on push / deploy (push) Failing after 9s

This commit is contained in:
Untone 2024-08-07 13:47:10 +03:00
parent 7e89a3471f
commit 087f6a7157

View File

@ -49,6 +49,7 @@ def query_shouts():
).label("rating_stat"), ).label("rating_stat"),
func.max(aliased_reaction.created_at).label("last_reacted_at"), func.max(aliased_reaction.created_at).label("last_reacted_at"),
array_agg( array_agg(
func.distinct(
func.json_build_object( func.json_build_object(
"id", "id",
Author.id, Author.id,
@ -59,8 +60,10 @@ def query_shouts():
"pic", "pic",
Author.pic, Author.pic,
) )
)
).label("authors"), ).label("authors"),
array_agg( array_agg(
func.distinct(
func.json_build_object( func.json_build_object(
"id", "id",
Topic.id, Topic.id,
@ -71,6 +74,7 @@ def query_shouts():
"slug", "slug",
Topic.slug, Topic.slug,
) )
)
).label("topics"), ).label("topics"),
) )
.outerjoin(aliased_reaction, aliased_reaction.shout == Shout.id) .outerjoin(aliased_reaction, aliased_reaction.shout == Shout.id)