feat: include moderation screen and platform cut #2

Open
Rodrigo wants to merge 2 commits from feat/add-moderation-screen into main
Owner

Product Moderation & Platform Cut — Walkthrough

Summary

Implemented a product moderation system where all newly created products default to pending status with a 5% platform cut. Pending products are hidden from public-facing endpoints. Admins can view, approve (with optional cut adjustment), or reject products.

Files Changed

New Files

File Purpose
2026_03_09_211500_add_moderation_to_products_table.php Migration adding platform_cut and moderation_status to products
ModerationController.php Admin-only controller for moderation actions

Modified Files

File Changes
Product.php Added platform_cut, moderation_status to fillable & casts
ProductResource.php Added platform_cut, moderation_status to API response
ProductController.php Filtered public routes to only show approved products
web.php Added 4 admin moderation routes

New Admin Endpoints

Method Endpoint Description
GET /admin/moderacao/pendentes/contagem Count of pending products
GET /admin/moderacao/pendentes Paginated list of pending products
POST /admin/moderacao/produtos/{product}/aprovar Approve product (optional platform_cut body param)
POST /admin/moderacao/produtos/{product}/rejeitar Reject product

Verification

  • All 4 moderation routes confirmed registered via artisan route:list
  • Migration needs to be run on a machine with the SQLite driver: php artisan migrate
# Product Moderation & Platform Cut — Walkthrough ## Summary Implemented a product moderation system where all newly created products default to `pending` status with a 5% platform cut. Pending products are hidden from public-facing endpoints. Admins can view, approve (with optional cut adjustment), or reject products. ## Files Changed ### New Files | File | Purpose | |------|---------| | [2026_03_09_211500_add_moderation_to_products_table.php](file:///home/rodrigo/Documentos/ecomm/database/migrations/2026_03_09_211500_add_moderation_to_products_table.php) | Migration adding `platform_cut` and `moderation_status` to `products` | | [ModerationController.php](file:///home/rodrigo/Documentos/ecomm/app/Http/Controllers/ModerationController.php) | Admin-only controller for moderation actions | ### Modified Files | File | Changes | |------|---------| | [Product.php](file:///home/rodrigo/Documentos/ecomm/app/Models/Product.php) | Added `platform_cut`, `moderation_status` to fillable & casts | | [ProductResource.php](file:///home/rodrigo/Documentos/ecomm/app/Http/Resources/ProductResource.php) | Added `platform_cut`, `moderation_status` to API response | | [ProductController.php](file:///home/rodrigo/Documentos/ecomm/app/Http/Controllers/ProductController.php) | Filtered public routes to only show approved products | | [web.php](file:///home/rodrigo/Documentos/ecomm/routes/web.php) | Added 4 admin moderation routes | ## New Admin Endpoints | Method | Endpoint | Description | |--------|----------|-------------| | `GET` | `/admin/moderacao/pendentes/contagem` | Count of pending products | | `GET` | `/admin/moderacao/pendentes` | Paginated list of pending products | | `POST` | `/admin/moderacao/produtos/{product}/aprovar` | Approve product (optional `platform_cut` body param) | | `POST` | `/admin/moderacao/produtos/{product}/rejeitar` | Reject product | ## Verification - ✅ All 4 moderation routes confirmed registered via `artisan route:list` - ⏳ Migration needs to be run on a machine with the SQLite driver: `php artisan migrate`
Rodrigo self-assigned this 2026-03-09 21:25:24 +00:00
Rodrigo changed title from feat: include moderation screen and platform cut to WIP: feat: include moderation screen and platform cut 2026-03-09 21:25:27 +00:00
Rodrigo changed title from WIP: feat: include moderation screen and platform cut to feat: include moderation screen and platform cut 2026-03-09 21:25:39 +00:00
Rodrigo stopped working 2026-03-09 21:26:04 +00:00
11 seconds
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/add-moderation-screen:feat/add-moderation-screen
git switch feat/add-moderation-screen

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff feat/add-moderation-screen
git switch feat/add-moderation-screen
git rebase main
git switch main
git merge --ff-only feat/add-moderation-screen
git switch feat/add-moderation-screen
git rebase main
git switch main
git merge --no-ff feat/add-moderation-screen
git switch main
git merge --squash feat/add-moderation-screen
git switch main
git merge --ff-only feat/add-moderation-screen
git switch main
git merge feat/add-moderation-screen
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Total time spent: 11 seconds
Rodrigo
11 seconds
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Rodrigo/PvAuto!2
No description provided.