Skip to content

Commit dca31ba

Browse files
committed
Moving collection id to query parameter.
1 parent b324592 commit dca31ba

File tree

1 file changed

+14
-5
lines changed
  • stac_fastapi/elasticsearch/stac_fastapi/elasticsearch

1 file changed

+14
-5
lines changed

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/core.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,9 @@ async def post_search(
413413
)
414414

415415
if search_request.query:
416-
for (field_name, expr) in search_request.query.items():
416+
for field_name, expr in search_request.query.items():
417417
field = "properties__" + field_name
418-
for (op, value) in expr.items():
418+
for op, value in expr.items():
419419
search = self.database.apply_stacql_filter(
420420
search=search, op=op, field=field, value=value
421421
)
@@ -627,9 +627,18 @@ async def update_collection(
627627
"""
628628
base_url = str(kwargs["request"].base_url)
629629

630-
await self.database.find_collection(collection_id=collection["id"])
631-
await self.delete_collection(collection["id"])
632-
await self.create_collection(collection, **kwargs)
630+
collection_id = kwargs["request"].query_params.get(
631+
"collection_id", collection["id"]
632+
)
633+
634+
collection_links = CollectionLinks(
635+
collection_id=collection["id"], base_url=base_url
636+
).create_links()
637+
collection["links"] = collection_links
638+
639+
await self.database.update_collection(
640+
collection_id=collection_id, collection=collection
641+
)
633642

634643
return CollectionSerializer.db_to_stac(collection, base_url)
635644

0 commit comments

Comments
 (0)