Skip to content

Commit

Permalink
fixed parameters query param for locations, countries, and providers (#…
Browse files Browse the repository at this point in the history
…306)

* fixed parameters query param for locations, countries
and providers

* Made requested changes to implement
ParametersQuery

---------

Co-authored-by: Gabriel Fosse <[email protected]>
  • Loading branch information
majesticio and Gabriel Fosse authored Dec 19, 2023
1 parent 0801197 commit a96d9ed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ cdk.out/
*.egg-info
.build
openaq_api/openaq_api/templates/*
openaq_api/openaq_api/static/assets/*
openaq_api/openaq_api/static/assets/*
.python-version
Pipfile
4 changes: 2 additions & 2 deletions openaq_api/openaq_api/v3/models/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class Paging(QueryBaseModel):

def pagination(self) -> str:
return "LIMIT :limit OFFSET :offset"


class ParametersQuery(QueryBaseModel):
"""Pydantic query model for the parameters query parameter
Expand All @@ -289,7 +289,7 @@ class ParametersQuery(QueryBaseModel):
def where(self) -> str | None:
""" """
if self.has("parameters_id"):
return "parameters_id = ANY (:parameters_id)"
return "parameter_ids && :parameters_id"


class MobileQuery(QueryBaseModel):
Expand Down
2 changes: 2 additions & 0 deletions openaq_api/openaq_api/v3/routers/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
MonitorQuery,
OwnerQuery,
Paging,
ParametersQuery,
ProviderQuery,
QueryBaseModel,
QueryBuilder,
Expand Down Expand Up @@ -69,6 +70,7 @@ class LocationsQueries(
Paging,
RadiusQuery,
BboxQuery,
ParametersQuery,
ProviderQuery,
OwnerQuery,
CountryIdQuery,
Expand Down

0 comments on commit a96d9ed

Please sign in to comment.