Skip to content

Commit cf47504

Browse files
committed
add function descriptions
1 parent 83c2843 commit cf47504

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/database_logic.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ def execute_search(self, search, limit: int, base_url: str) -> List:
237237
# Transaction Logic
238238

239239
def prep_create_item(self, item: stac_types.Item, base_url: str):
240+
"""Database logic for prepping an item for insertion."""
240241
if not self.client.exists(index=COLLECTIONS_INDEX, id=item["collection"]):
241242
raise ForeignKeyError(f"Collection {item['collection']} does not exist")
242243

@@ -250,6 +251,7 @@ def prep_create_item(self, item: stac_types.Item, base_url: str):
250251
return self.item_serializer.stac_to_db(item, base_url)
251252

252253
def create_item(self, item: stac_types.Item, base_url: str):
254+
"""Database logic for creating one item."""
253255
# todo: check if collection exists, but cache
254256
es_resp = self.client.index(
255257
index=ITEMS_INDEX,
@@ -263,10 +265,12 @@ def create_item(self, item: stac_types.Item, base_url: str):
263265
)
264266

265267
def prep_update_item(self, item: stac_types.Item):
268+
"""Database logic for prepping an item for updating."""
266269
if not self.client.exists(index=COLLECTIONS_INDEX, id=item["collection"]):
267270
raise ForeignKeyError(f"Collection {item['collection']} does not exist")
268271

269272
def delete_item(self, item_id: str, collection_id: str):
273+
"""Database logic for deleting one item."""
270274
try:
271275
self.client.delete(index=ITEMS_INDEX, id=mk_item_id(item_id, collection_id))
272276
except elasticsearch.exceptions.NotFoundError:
@@ -286,7 +290,7 @@ def create_collection(self, collection: stac_types.Collection):
286290
)
287291

288292
def prep_update_collection(self, collection_id: str):
289-
"""Database logic for updating a collection."""
293+
"""Database logic for prepping a collection for updating."""
290294
try:
291295
_ = self.client.get(index=COLLECTIONS_INDEX, id=collection_id)
292296
except elasticsearch.exceptions.NotFoundError:

0 commit comments

Comments
 (0)