Skip to content

Commit

Permalink
Add support for filter by domain
Browse files Browse the repository at this point in the history
  • Loading branch information
hellais committed Oct 11, 2024
1 parent 11d2efa commit ca149a0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ooniapi/services/oonifindings/src/oonifindings/routers/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ def list_oonifindings(
list[str] | None,
Query(description="The asn to filter by"),
] = None,
domain: Annotated[
list[str] | None,
Query(description="The domain to filter by"),
] = None,
authorization: str = Header("authorization"),
db=Depends(get_postgresql_session),
settings=Depends(get_settings),
Expand Down Expand Up @@ -171,6 +175,8 @@ def list_oonifindings(
)
if asn:
q = q.filter(sa.or_(*[models.OONIFinding.asns.any_() == c for c in asn]))
if domain:
q = q.filter(sa.or_(*[models.OONIFinding.domains.any_() == d for d in domain]))

if account_id is None:
# non-published incidents are not exposed to anon users
Expand Down

0 comments on commit ca149a0

Please sign in to comment.