Skip to content

Commit

Permalink
Rename generate_presigned_upload_url function #11
Browse files Browse the repository at this point in the history
  • Loading branch information
joelvdavies committed Sep 24, 2024
1 parent 066d2f2 commit 34be34f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion object_storage_api/services/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def create(self, attachment: AttachmentPostSchema) -> AttachmentPostResponseSche
:return: Created attachment with an pre-signed upload URL.
"""

attachment_in, upload_url = self._attachment_store.generate_presigned_upload_url(attachment)
attachment_in, upload_url = self._attachment_store.create(attachment)
attachment_out = self._attachment_repository.create(attachment_in)

return AttachmentPostResponseSchema(**attachment_out.model_dump(), upload_url=upload_url)
5 changes: 3 additions & 2 deletions object_storage_api/stores/attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ class AttachmentStore:
Store for managing attachments in an S3 object store.
"""

def generate_presigned_upload_url(self, attachment: AttachmentPostSchema) -> tuple[AttachmentIn, str]:
def create(self, attachment: AttachmentPostSchema) -> tuple[AttachmentIn, str]:
"""
Generates a presigned URL for uploading an attachment.
Creates an `AttachmentIn` database model with the file object key and generates a presigned URL for uploading
it.
:param attachment: Attachment to generate the URL for.
:return: Tuple with
Expand Down

0 comments on commit 34be34f

Please sign in to comment.