Skip to content

feat(storage): persist admin project and badge images to internal storage - #78

Merged
lucas-matw-unq merged 1 commit into
mainfrom
feature/garage-admin-images
Oct 4, 2026
Merged

lucas-matw-unq merged 1 commit into
mainfrom
feature/garage-admin-images

Conversation

@lucas-matw-unq

Copy link
Copy Markdown
Collaborator

Summary

This PR enables internal storage persistence (via S3/Garage) for administrative assets (project cover images and gamification badges) and provides an automated migration endpoint for existing projects.

Changes

  • Storage Service (storage.service.ts):
    • Enhanced optimizeImage to detect transparency (metadata.hasAlpha or PNG/WebP mime types) and compress to WebP with 100% alpha quality instead of JPEG, preventing solid black backgrounds on transparent icons.
    • Added unit tests verifying transparency preservation for PNGs.
  • Project Controller & Service (project.service.ts, project.controller.ts):
    • Added POST /v1/projects/:projectId/migrate-images endpoint to download external HTTP(S) image assets, compress/optimize them with Sharp, upload them to internal storage, and atomically update MongoDB references.
    • Added atomic badge image update support in GamificationDao.
    • Added tests for migrateImages.

@lucas-matw-unq
lucas-matw-unq merged commit 59f2ac4 into main Oct 4, 2026
2 checks passed
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