@@ -237,6 +237,7 @@ def execute_search(self, search, limit: int, base_url: str) -> List:
237
237
# Transaction Logic
238
238
239
239
def prep_create_item (self , item : stac_types .Item , base_url : str ):
240
+ """Database logic for prepping an item for insertion."""
240
241
if not self .client .exists (index = COLLECTIONS_INDEX , id = item ["collection" ]):
241
242
raise ForeignKeyError (f"Collection { item ['collection' ]} does not exist" )
242
243
@@ -250,6 +251,7 @@ def prep_create_item(self, item: stac_types.Item, base_url: str):
250
251
return self .item_serializer .stac_to_db (item , base_url )
251
252
252
253
def create_item (self , item : stac_types .Item , base_url : str ):
254
+ """Database logic for creating one item."""
253
255
# todo: check if collection exists, but cache
254
256
es_resp = self .client .index (
255
257
index = ITEMS_INDEX ,
@@ -263,10 +265,12 @@ def create_item(self, item: stac_types.Item, base_url: str):
263
265
)
264
266
265
267
def prep_update_item (self , item : stac_types .Item ):
268
+ """Database logic for prepping an item for updating."""
266
269
if not self .client .exists (index = COLLECTIONS_INDEX , id = item ["collection" ]):
267
270
raise ForeignKeyError (f"Collection { item ['collection' ]} does not exist" )
268
271
269
272
def delete_item (self , item_id : str , collection_id : str ):
273
+ """Database logic for deleting one item."""
270
274
try :
271
275
self .client .delete (index = ITEMS_INDEX , id = mk_item_id (item_id , collection_id ))
272
276
except elasticsearch .exceptions .NotFoundError :
@@ -286,7 +290,7 @@ def create_collection(self, collection: stac_types.Collection):
286
290
)
287
291
288
292
def prep_update_collection (self , collection_id : str ):
289
- """Database logic for updating a collection."""
293
+ """Database logic for prepping a collection for updating ."""
290
294
try :
291
295
_ = self .client .get (index = COLLECTIONS_INDEX , id = collection_id )
292
296
except elasticsearch .exceptions .NotFoundError :
0 commit comments