Skip to content

Commit

Permalink
Merge pull request #220 from Police-Data-Accessibility-Project/mc_562…
Browse files Browse the repository at this point in the history
…_add_location_id_to_search_follow_get

Add location id to `/search/follow` `GET`
  • Loading branch information
maxachis authored Dec 13, 2024
2 parents 58131ed + 6606d9d commit aa73c32
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion database_client/database_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,11 +1179,12 @@ def _build_column_references(
right_link_column="location_id",
linked_relation=Relations.LOCATIONS_EXPANDED,
linked_relation_linking_column="id",
columns_to_retrieve=["state_name", "county_name", "locality_name"],
columns_to_retrieve=["state_name", "county_name", "locality_name", "id"],
alias_mappings={
"state_name": "state",
"county_name": "county",
"locality_name": "locality",
"id": "location_id",
},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,10 @@ class FollowSearchResponseSchema(Schema):
"The locality of the search. If empty, all localities for the given county will be searched."
),
)
location_id = fields.Int(
required=True,
metadata=get_json_metadata("The location ID of the search."),
)


GetUserFollowedSearchesSchema = create_get_many_schema(
Expand Down
1 change: 1 addition & 0 deletions tests/integration/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ def follow_extant_location(
"state": TEST_STATE,
"county": TEST_COUNTY,
"locality": TEST_LOCALITY,
"location_id": sts.location_id
}],
"message": "Followed searches found.",
},
Expand Down

0 comments on commit aa73c32

Please sign in to comment.