Skip to content

Commit

Permalink
fix categories /brands filter
Browse files Browse the repository at this point in the history
  • Loading branch information
AdenForshaw committed Oct 31, 2024
1 parent 503729c commit dcc763a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ Test the API by curl on `http://localhost:8080/places/countries` with the DEMO-A
curl -H "x-api-key: DEMO-API-KEY" -X GET -G 'http://localhost:8080/places/brands' -d 'country=AU'
```

```bash
curl -H "x-api-key: DEMO-API-KEY" -X GET -G 'http://localhost:8080/places/brands' -d 'country=AU' -d 'category=adult_store'
```

```bash
curl -H "x-api-key: DEMO-API-KEY" -X GET -G 'http://localhost:8080/places' -d 'country=AU' -d 'brand_name=TAB' -d 'limit=2' -d 'format=geojson'
```

```bash
curl -H "x-api-key: DEMO-API-KEY" -X GET -G 'http://localhost:8080/places/categories' -d 'country=AU'
curl -H "x-api-key: DEMO-API-KEY" -X GET -G 'http://localhost:8080/places/brands' -d 'country=AU' -d 'categories=adult_store,airlines,airline'
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "overture-maps-api",
"version": "0.0.3",
"version": "0.0.4",
"description": "",
"author": "",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion src/bigquery/bigquery.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class BigQueryService {
}
query += ` AND brand IS NOT NULL`;
if(categories && categories.length > 0){
query += ` AND category.primary IN UNNEST(["${categories.join('","')}"])`;
query += ` AND categories.primary IN UNNEST(["${categories.join('","')}"])`;
}
if (require_wikidata) {
query += ` AND brand.wikidata IS NOT NULL`;
Expand Down
2 changes: 1 addition & 1 deletion src/places/dto/get-brands.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class GetBrandsDto {

//transform into an array of strings
@IsOptional()
@Transform(({ value }) => value.split(','))
@Transform(({ value }) => String(value).split(','))
@IsString({ each: true })
categories?: string[]; // Array of category names
}

0 comments on commit dcc763a

Please sign in to comment.