Skip to content

Commit

Permalink
Address PR Review Changes #93
Browse files Browse the repository at this point in the history
  • Loading branch information
asuresh-code committed Jan 23, 2025
1 parent 97195ef commit ecea373
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion object_storage_api/services/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def get(self, image_id: str) -> ImageSchema:
:return: An image's metadata with its presigned get urls.
"""
image = self._image_repository.get(image_id=image_id)
(view_url, download_url) = self._image_store.create_presigned_get(image)
view_url, download_url = self._image_store.create_presigned_get(image)
return ImageSchema(**image.model_dump(), view_url=view_url, download_url=download_url)

def list(self, entity_id: Optional[str] = None, primary: Optional[bool] = None) -> list[ImageMetadataSchema]:
Expand Down
6 changes: 3 additions & 3 deletions object_storage_api/stores/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ def create_presigned_get(self, image: ImageOut) -> tuple[str, str]:
"ExpiresIn": object_storage_config.presigned_url_expiry_seconds,
}

view_response = s3_client.generate_presigned_url(**parameters)
view_url = s3_client.generate_presigned_url(**parameters)

attachment_response = s3_client.generate_presigned_url(
download_url = s3_client.generate_presigned_url(
**{
**parameters,
"Params": {
Expand All @@ -70,7 +70,7 @@ def create_presigned_get(self, image: ImageOut) -> tuple[str, str]:
}
)

return (view_response, attachment_response)
return view_url, download_url

def delete(self, object_key: str) -> None:
"""
Expand Down
5 changes: 1 addition & 4 deletions test/unit/repositories/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,7 @@ def set_update_data(self, new_image_in_data: dict):
"""
self._image_in = ImageIn(**new_image_in_data)

def mock_update(
self,
new_image_in_data: dict,
) -> None:
def mock_update(self, new_image_in_data: dict) -> None:
"""
Mocks database methods appropriately to test the `update` repo method.
Expand Down

0 comments on commit ecea373

Please sign in to comment.