ашчуы
This commit is contained in:
@@ -102,7 +102,7 @@ class AssetsRepo:
|
||||
|
||||
return assets
|
||||
|
||||
async def get_asset(self, asset_id: str, with_data: bool = True) -> Asset:
|
||||
async def get_asset(self, asset_id: str, with_data: bool = True) -> Optional[Asset]:
|
||||
projection = None
|
||||
if not with_data:
|
||||
projection = {"data": 0, "thumbnail": 0}
|
||||
@@ -182,7 +182,9 @@ class AssetsRepo:
|
||||
return await self.collection.count_documents(filter)
|
||||
|
||||
async def get_assets_by_ids(self, asset_ids: List[str]) -> List[Asset]:
|
||||
object_ids = [ObjectId(asset_id) for asset_id in asset_ids]
|
||||
object_ids = [ObjectId(asset_id) for asset_id in asset_ids if ObjectId.is_valid(asset_id)]
|
||||
if not object_ids:
|
||||
return []
|
||||
res = self.collection.find({"_id": {"$in": object_ids}}, {"data": 0}) # Exclude data but maybe allow thumbnail if small?
|
||||
# Original excluded thumbnail too.
|
||||
assets = []
|
||||
|
||||
Reference in New Issue
Block a user