Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fix Docker compose file, so example data can be loaded into database (author @zstatmanweil, <https://github.com/stac-utils/stac-fastapi-pgstac/pull/142>)
- Add collection search extension ([#139](https://github.com/stac-utils/stac-fastapi-pgstac/pull/139))
- keep item- and collection-search extensions separate ([#158](https://github.com/stac-utils/stac-fastapi-pgstac/pull/158))

- Fix `filter` extension implementation in `CoreCrudClient`

Expand Down
17 changes: 16 additions & 1 deletion stac_fastapi/pgstac/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
"bulk_transactions": BulkTransactionExtension(client=BulkTransactionsClient()),
}

# some extensions are supported in combination with the collection search extension
collection_extensions_map = {
"query": QueryExtension(),
"sort": SortExtension(),
"fields": FieldsExtension(),
"filter": FilterExtension(client=FiltersClient()),
}

enabled_extensions = (
os.environ["ENABLED_EXTENSIONS"].split(",")
if "ENABLED_EXTENSIONS" in os.environ
Expand All @@ -70,10 +78,17 @@
)

collection_search_extension = (
CollectionSearchExtension.from_extensions(extensions)
CollectionSearchExtension.from_extensions(
[
extension
for key, extension in collection_extensions_map.items()
if key in enabled_extensions
]
)
if "collection_search" in enabled_extensions
else None
)

collections_get_request_model = (
collection_search_extension.GET if collection_search_extension else EmptyRequest
)
Expand Down
Loading