Skip to content

Commit

Permalink
Merge pull request #205 from hotosm/rename/iso3_fields
Browse files Browse the repository at this point in the history
Enhance : Request param in iso3
  • Loading branch information
kshitijrajsharma authored Jan 20, 2024
2 parents 587a8dc + fb54656 commit 6c220c6
Show file tree
Hide file tree
Showing 9 changed files with 332 additions and 331 deletions.
50 changes: 25 additions & 25 deletions API/data/hdx.sql

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions API/data/tables.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE TABLE if not exists public.countries (
cid int4 NOT NULL,
"name" varchar NULL,
iso_3 varchar(3) NULL,
iso3 varchar(3) NULL,
geometry public.geometry(multipolygon, 4326),
CONSTRAINT countries_pk PRIMARY KEY (cid)
);
Expand All @@ -16,7 +16,7 @@ CREATE table if not exists public.users (

CREATE TABLE if not exists public.hdx (
id SERIAL PRIMARY KEY,
iso_3 VARCHAR(3) NULL,
iso3 VARCHAR(3) NULL,
cid INT NULL,
hdx_upload BOOLEAN DEFAULT true,
dataset JSONB,
Expand Down
2 changes: 1 addition & 1 deletion API/hdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async def read_hdx_list(
filters = {}
for key, values in request.query_params.items():
if key not in ["skip", "limit"]:
if key in ["iso_3", "queue", "meta", "hdx_upload", "cid"]:
if key in ["iso3", "id", "queue", "meta", "hdx_upload", "cid"]:
filters[f"{key} = %s"] = values
continue
filters[f"dataset->>'{key}' = %s"] = values
Expand Down
2 changes: 1 addition & 1 deletion backend/countries/countries.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cid,description,iso_3,dataset_name,locations
cid,description,iso3,dataset_name,locations
168,Afghanistan,AFG,hotosm_afg,{afg}
170,Albania,ALB,hotosm_alb,{alb}
100,Algeria,DZA,hotosm_dza,{dza}
Expand Down
478 changes: 239 additions & 239 deletions backend/countries/countries.geojson

Large diffs are not rendered by default.

50 changes: 25 additions & 25 deletions backend/sql/countries.sql

Large diffs are not rendered by default.

Loading

0 comments on commit 6c220c6

Please sign in to comment.