feat(admin): add media library with uploads and reusable picker#46
Merged
Conversation
Adds a Media Library page under Design with drag-and-drop upload, multi-select uploads, copy-URL action, and delete. Files are stored locally under /uploads (already served by the server) and indexed in a new MediaAsset table that captures filename, original name, MIME type, size, and uploader. A reusable MediaPickerModal component is included so other admin forms (gallery, hero, menu items, banners) can adopt it incrementally without re-implementing the listing/upload flow. New endpoints (staff-only): GET /api/media — paginated list POST /api/media/upload — multipart upload (5 MB, image only) DELETE /api/media/:id — removes DB row and underlying file Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4c4d920 to
281f84a
Compare
Adds integration tests for GET /api/media, POST /api/media/upload, and DELETE /api/media/:id — covering auth gating, the no-file upload error path, not-found, and the happy-path delete that clears both the file (mocked) and the DB row. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
281f84a to
3d1f8e5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/design/mediawith drag-and-drop upload, multi-select uploads, copy-URL action, and delete./uploads(already served by the server) and indexed in a newMediaAssettable that captures filename, original name, MIME type, size, and uploader.MediaPickerModalcomponent so other admin forms (gallery, hero, menu items, banners) can adopt it incrementally without re-implementing the listing/upload flow.Covers item 3 of the Moksha post-pitch backlog (image upload + media library).
New endpoints (staff-only):
GET /api/media— paginated listPOST /api/media/upload— multipart upload (5 MB, image only)DELETE /api/media/:id— removes DB row + underlying fileTest plan
uploads/folderFollow-ups
MediaPickerModalinto the gallery admin form (F2'sDesignGallery) to replace the manual URL paste with a "Pick from library" button.🤖 Generated with Claude Code