From 3ff52f944c25eb066814f91596b7933e6528d73a Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 18 Jul 2024 09:05:10 +0300 Subject: [PATCH] slug-filter-author --- resolvers/reaction.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/resolvers/reaction.py b/resolvers/reaction.py index 150c54f5..14ea8881 100644 --- a/resolvers/reaction.py +++ b/resolvers/reaction.py @@ -336,6 +336,10 @@ def apply_reaction_filters(by, q): if created_by: q = q.filter(Author.id == created_by) + author_slug = by.get("author", None) + if author_slug: + q = q.filter(Author.slug == author_slug) + topic = by.get("topic", None) if isinstance(topic, int): q = q.filter(Shout.topics.any(id=topic)) @@ -364,7 +368,8 @@ async def load_reactions_by(_, info, by, limit=50, offset=0): :param by: { :shout - filter by slug :shouts - filer by shout slug list - :created_by - to filter by author + :created_by - to filter by author ID + :author - to filter by author slug :topic - to filter by topic :search - to search by reactions' body :comment - true if body.length > 0