Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage Service Enhancements and Refactoring #350

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

Ziadsharkos
Copy link
Contributor

🔥 Overview

This PR introduces significant improvements to the Storage Service, including enhancements to file handling, API documentation, security configurations, and dependency management. These changes optimize file storage and retrieval while ensuring better maintainability and test coverage.

✨ Key Changes

🚀 Feature Enhancements

  • Implemented a Mime Service to support correct file download behavior with accurate MIME type detection.
  • Enhanced Object Storage API with detailed Swagger documentation to improve usability and clarity.

🔄 Refactoring and Code Improvements

  • Moved file handling logic from the controller to the service layer for better modularity.
  • Refactored ObjectStorageService to encapsulate business logic in the storage package.
  • Updated the MinioConfig service to include bucket existence checks and structured Minio client initialization.
  • Changed how file types are identified, ensuring correct MIME type assignment.

🛠 Fixes and Security Updates

  • Updated security configurations:
    • Allowed public access to /objects/file/** for file retrieval.
    • Introduced security improvements in SecurityConfig and MinioConfig.
  • Fixed endpoint mappings for file storage and retrieval.
  • Added @Generated annotation to MinioConfig and SecurityConfig to improve code maintainability.

📦 Dependency and Build Optimizations

  • Added necessary dependencies for WebMVC and MimeUtil to handle file operations efficiently.
  • Removed unnecessary dependencies to streamline the build process.
  • Upgraded Spring Boot and dependency versions for improved stability and security.

🧪 Testing and Coverage

  • Modified unit tests to align with changes in DTOs and service logic.
  • Added unit tests for MIME type detection to ensure file types are correctly identified.
  • Enhanced test cases for file uploads and retrievals to validate the new service logic.

📌 Breaking Changes

  • Removed legacy ObjectResponse DTO and replaced it with ObjectStorageResponse.
  • Reworked security configurations, allowing external access to file retrieval endpoints while maintaining API security.

🚀 How to Test

  1. Run the service locally and test:
    • File uploads via /objects/upload.
    • File retrieval via /objects/file/{path}.
    • Swagger API documentation for validation.
  2. Execute unit tests:
    ./gradlew test

@Ziadsharkos Ziadsharkos added backend Backend related, server side Storage Epic user story 7 labels Feb 23, 2025
@Ziadsharkos Ziadsharkos added this to the Iteration 10 milestone Feb 23, 2025
@walidoow walidoow modified the milestones: Iteration 10, Iteration 11 Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend related, server side Storage Epic user story 7
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants