Skip to content

Commit 7d87e4f

Browse files
committed
update update item
1 parent 440b702 commit 7d87e4f

File tree

1 file changed

+17
-7
lines changed
  • stac_fastapi/elasticsearch/stac_fastapi/elasticsearch

1 file changed

+17
-7
lines changed

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/core.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,17 +412,27 @@ async def create_item(
412412
return item
413413

414414
@overrides
415-
async def update_item(
416-
self, collection_id: str, item_id: str, item: stac_types.Item, **kwargs
417-
) -> stac_types.Item:
418-
"""Update item."""
419-
base_url = str(kwargs["request"].base_url)
415+
async def update_item(self, collection_id: str, item_id: str, item: stac_types.Item, **kwargs) -> stac_types.Item:
416+
"""Update an item in the collection.
417+
418+
Args:
419+
collection_id (str): The ID of the collection the item belongs to.
420+
item_id (str): The ID of the item to be updated.
421+
item (stac_types.Item): The new item data.
422+
kwargs: Other optional arguments, including the request object.
423+
424+
Returns:
425+
stac_types.Item: The updated item object.
420426
427+
Raises:
428+
NotFound: If the specified collection is not found in the database.
429+
430+
"""
431+
base_url = str(kwargs["request"].base_url)
421432
now = datetime_type.now(timezone.utc).isoformat().replace("+00:00", "Z")
422-
item["properties"]["updated"] = str(now)
433+
item["properties"]["updated"] = now
423434

424435
await self.database.check_collection_exists(collection_id)
425-
# todo: index instead of delete and create
426436
await self.delete_item(item_id=item_id, collection_id=collection_id)
427437
await self.create_item(collection_id=collection_id, item=item, **kwargs)
428438

0 commit comments

Comments
 (0)