Skip to content

Release/v0.3.1#76

Merged
jhonatapers merged 3 commits intomainfrom
release/v0.3.1
Aug 28, 2025
Merged

Release/v0.3.1#76
jhonatapers merged 3 commits intomainfrom
release/v0.3.1

Conversation

@jhonatapers
Copy link
Copy Markdown
Member

This pull request refactors how file content is managed and accessed by replacing the use of "location" with "storageKey" throughout the application. It also updates the StorageService interface to use storageKey for all operations and introduces streaming support for file content retrieval. Additionally, it improves error handling when storing files and updates related tests accordingly.

Core Refactoring: Storage Key Usage

  • Replaced all references to location in the Content value object with storageKey, updating methods, validation, and usages across the application and domain layers. (Content.java, DefaultCreateFileUseCase.java, DefaultDeleteFileUseCase.java, related test files) [1] [2] [3] [4] [5]

File Content Retrieval and Streaming

  • Changed GetFileContentOutput to return an InputStream instead of a file location, and updated the use case to retrieve file content as a stream from StorageService. (GetFileContentOutput.java, DefaultGetFileContentUseCase.java, test updates) [1] [2] [3] [4] [5] [6]

Storage Service Interface and Error Handling

  • Updated the StorageService interface to use storageKey for storing, retrieving, and deleting files, and to support streaming with an InputStream. Introduced the StorageKeyAlreadyExistsException for handling duplicate keys during storage. (StorageService.java, StorageKeyAlreadyExistsException.java, DefaultCreateFileUseCase.java) [1] [2] [3]
  • Modified file creation logic to generate unique storage keys and handle potential key collisions by retrying on StorageKeyAlreadyExistsException.

Test Updates

  • Updated tests to use storageKey instead of location, to mock the new streaming and storage behaviors, and to verify correct interactions with the updated StorageService interface. (DefaultCreateFileUseCaseTest.java, DefaultGetFileContentUseCaseTest.java, DefaultDeleteFileUseCaseTest.java, FileTest.java) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

API/Controller Layer

  • Updated the file controller to use InputStreamResource instead of FileSystemResource for serving file content, matching the new streaming approach. (FileController.java)

@jhonatapers jhonatapers self-assigned this Aug 28, 2025
@jhonatapers jhonatapers merged commit fae55b6 into main Aug 28, 2025
@jhonatapers jhonatapers deleted the release/v0.3.1 branch August 28, 2025 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant