feat: add Post category field and client-side image compression#285
Closed
Uchechukwu-Ekezie wants to merge 1 commit intogeevapp:mainfrom
Closed
Conversation
Closes #204 Closes #64 Issue #204 — Post category field - Add PostCategory enum (electronics, clothing, books, furniture, toys, food, sports, beauty, automotive, other) to schema.prisma - Add optional category field to Post model with @@index for fast filtering - Migration: 20260423000000_add_post_category - POST /api/posts now accepts and stores category - GET /api/posts already filtered by ?category= — now backed by the real field Issue #64 — Client-side image optimisation - New lib/image-compression.ts: compressImage() (max 0.5 MB / 1200×1200, WebP when supported, fallback JPEG), generateThumbnail() (300×300), formatFileSize() helper — all powered by browser-image-compression - Updated MediaUpload component: - Images compressed + thumbnail generated before upload - "Optimising…" overlay during compression, "Uploading…" during transfer - After upload: before/after size badge ("1.8 MB → 312 KB (−83%)") - Toast notification with savings summary - Falls back to original file on compression error Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
@Uchechukwu-Ekezie Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Author
|
Superseded — PR will be raised against OpenSourceCOntr/geev |
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.
Closes #204
Closes #64
What changed
Issue #204 — Add Post
categoryfieldPostCategoryenum toschema.prismawith 10 predefined values:electronics,clothing,books,furniture,toys,food,sports,beauty,automotive,othercategory PostCategory?to thePostmodel with a@@index([category])for fast filtering20260423000000_add_post_category/migration.sqlPOST /api/postsnow accepts and storescategory— previously it was silently discardedGET /api/posts?category=electronicsfiltering was already wired in the handler; it now works against the real DB columnIssue #64 — Client-side image optimisation
lib/image-compression.tsutility powered bybrowser-image-compression:compressImage()— reduces images to <500 KB at max 1200×1200, outputs WebP when supported (fallback JPEG), quality 82%generateThumbnail()— generates 300×300 thumbnail as both aFileand a data URL for instant previewformatFileSize()— human-readable size stringMediaUploadcomponent:1.8 MB → 312 KB (−83%))How to test
GET /api/posts?category=electronics