slug-filter-author
All checks were successful
Deploy on push / deploy (push) Successful in 1m10s

This commit is contained in:
Untone 2024-07-18 09:05:10 +03:00
parent 77282ade62
commit 3ff52f944c

View File

@ -336,6 +336,10 @@ def apply_reaction_filters(by, q):
if created_by: if created_by:
q = q.filter(Author.id == 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) topic = by.get("topic", None)
if isinstance(topic, int): if isinstance(topic, int):
q = q.filter(Shout.topics.any(id=topic)) 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: { :param by: {
:shout - filter by slug :shout - filter by slug
:shouts - filer by shout slug list :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 :topic - to filter by topic
:search - to search by reactions' body :search - to search by reactions' body
:comment - true if body.length > 0 :comment - true if body.length > 0