Skip to content

Unique names and default sort for technologies and category #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
readme update
  • Loading branch information
max-ostapenko committed Feb 1, 2025
commit 72410e2e99f07c8535986a79002800f16d366c8d
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ This endpoint can return a full list of categories names or a categories with al

The following parameters can be used to filter the data:

- `category` (`required`): A comma-separated string representing the category name(s).
- `onlyname` (optional): A string 'true' or 'false'.
- `category` (optional): A comma-separated string representing the category name(s).
- `onlyname` (optional): No value required. If present, only the category names will be returned.

#### Response

Expand Down Expand Up @@ -245,18 +245,16 @@ Returns a JSON object with the following schema:

The following parameters can be used to filter the data:

- `technology` (`required`): A comma-separated string representing the technology name(s).
- `start` (optional): A string representing the start date in the format `YYYY-MM-DD`.
- `end` (optional): A string representing the end date in the format `YYYY-MM-DD`.
- `geo` (optional): A string representing the geographic location.
- `rank` (optional): An string representing the rank.
- `client` (optional): A string with the client: `mobile` or `desktop`.
- `technology` (optional): A comma-separated string representing the technology name(s) or `ALL`.
- `category` (optional): A comma-separated string representing the category name(s).
- `onlyname` (optional): No value required. If present, only the technology names will be returned.

#### Response

```bash
curl --request GET \
--url 'https://{{HOST}}/v1/technologies?start=2022-02-01&end=2022-04-01&category=Live%20chat%2C%20blog&technology=Smartsupp&client=mobile'
--url 'https://{{HOST}}/v1/technologies?category=Live%20chat%2C%20blog&technology=Smartsupp&client=mobile'
```

Returns a JSON object with the following schema:
Expand Down
2 changes: 1 addition & 1 deletion functions/categories/libs/queries.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from google.cloud import firestore
from google.cloud.firestore_v1.base_query import FieldFilter
from .result import Result
from .result import Result
from .utils import convert_to_array

DB = firestore.Client(project=os.environ.get('PROJECT'), database=os.environ.get('DATABASE'))
Expand Down
6 changes: 2 additions & 4 deletions functions/technologies/libs/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,13 @@ def list_data(params):
if onlyname and 'client' not in params:
appended_technologies = set()
for doc in documents:
item = doc.to_dict()
technology = item['technology']
technology = doc.get('technology')
if technology not in appended_technologies:
appended_technologies.add(technology)
data.append(technology)

else:
for doc in documents:
item = doc.to_dict()
data.append(Presenters.technology(item))
data.append(Presenters.technology(doc.to_dict()))

return Result(result=data)
Loading