Skip to content

feat: enhance file handling with storage key management and retrieval…#74

Merged
jhonatapers merged 1 commit intodevelopfrom
fix/download
Aug 28, 2025
Merged

feat: enhance file handling with storage key management and retrieval…#74
jhonatapers merged 1 commit intodevelopfrom
fix/download

Conversation

@jhonatapers
Copy link
Copy Markdown
Member

This pull request introduces significant changes to how file content is managed and retrieved in the application. The main update is the transition from using a file "location" string to a "storageKey" for identifying file content, and the adoption of streaming file content via InputStream rather than returning a location. This impacts the domain model, application use cases, service interfaces, and related tests. Additionally, the storage service interface is updated to support retrieving content streams, and a new exception is introduced for duplicate storage keys.

Domain model and API changes:

  • The Content value object now uses storageKey instead of location, and all validation, construction, and usage have been updated accordingly.
  • The GetFileContentOutput now returns an InputStream for file content instead of a location string, reflecting a shift to direct streaming of file content.

Application/service layer changes:

  • DefaultGetFileContentUseCase and related logic now use storageKey and retrieve file content via StorageService.retrieve, returning an InputStream to the caller. [1] [2]
  • The StorageService interface has been updated: store now returns void and throws if the key exists, delete and retrieve operate on storageKey.
  • The file creation flow now generates a random storageKey, retries if a key already exists (using the new StorageKeyAlreadyExistsException), and stores content under that key. [1] [2] [3]

Testing and validation:

  • All affected tests have been updated to use storageKey instead of location, and to verify streaming content via InputStream. [1] [2] [3] [4] [5] [6]
  • Mocking and assertions in tests have been adapted for the new service interface and content retrieval method. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

Infrastructure/API changes:

  • The API controller now uses InputStreamResource instead of FileSystemResource to serve file content streams.

Exception handling:

  • Introduced StorageKeyAlreadyExistsException to handle rare key collisions when storing content.

@jhonatapers jhonatapers self-assigned this Aug 28, 2025
@jhonatapers jhonatapers added bug Something isn't working enhancement New feature or request labels Aug 28, 2025
@jhonatapers jhonatapers moved this to Review in CallV2 Aug 28, 2025
@jhonatapers jhonatapers linked an issue Aug 28, 2025 that may be closed by this pull request
@jhonatapers jhonatapers merged commit 36c00d7 into develop Aug 28, 2025
@github-project-automation github-project-automation Bot moved this from Review to Done in CallV2 Aug 28, 2025
@jhonatapers jhonatapers deleted the fix/download branch August 28, 2025 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Fail-fast no download de conteúdo

1 participant