|
2 | 2 | import asyncio
|
3 | 3 | import logging
|
4 | 4 | from base64 import urlsafe_b64decode, urlsafe_b64encode
|
5 |
| -from typing import Dict, List, Optional, Tuple, Type, Union |
| 5 | +from typing import Dict, List, Optional, Tuple, Type, Union, Any, Iterable |
6 | 6 |
|
7 | 7 | import attr
|
8 | 8 | import elasticsearch
|
@@ -66,12 +66,12 @@ class DatabaseLogic:
|
66 | 66 |
|
67 | 67 | """CORE LOGIC"""
|
68 | 68 |
|
69 |
| - async def get_all_collections(self) -> List[Collection]: |
| 69 | + async def get_all_collections(self) -> List[Dict[str, Any]]: |
70 | 70 | """Database logic to retrieve a list of all collections."""
|
71 | 71 | # https://github.com/stac-utils/stac-fastapi-elasticsearch/issues/65
|
72 | 72 | # collections should be paginated, but at least return more than the default 10 for now
|
73 | 73 | collections = await self.client.search(index=COLLECTIONS_INDEX, size=1000)
|
74 |
| - return [c["_source"] for c in collections["hits"]["hits"]] |
| 74 | + return (c["_source"] for c in collections["hits"]["hits"]) |
75 | 75 |
|
76 | 76 | async def get_one_item(self, collection_id: str, item_id: str) -> Dict:
|
77 | 77 | """Database logic to retrieve a single item."""
|
@@ -190,7 +190,7 @@ async def execute_search(
|
190 | 190 | limit: int,
|
191 | 191 | token: Optional[str],
|
192 | 192 | sort: Optional[Dict[str, Dict[str, str]]],
|
193 |
| - ) -> Tuple[List[Item], Optional[int], Optional[str]]: |
| 193 | + ) -> Tuple[Iterable[Dict[str, Any]], Optional[int], Optional[str]]: |
194 | 194 | """Database logic to execute search with limit."""
|
195 | 195 | search_after = None
|
196 | 196 | if token:
|
|
0 commit comments