feat: Add Image Upload Status Polling Feature (#210)
Commit: 9121e2723416c054ef16d9f5a805176ab30f43cb
Date: 2025-07-09 15:15:35 +0200
Author: PascalHavelange
Commit Message
feat: Add Image Upload Status Polling Feature (#210)
# Add Image Upload Status Polling Feature
## Overview
Implemented a comprehensive status polling system for image uploads that allows clients to track the processing status of uploaded images in real-time.
## Changes Made
### Core Implementation
- **ImageUploadController**: Added `status(string $id)` endpoint to check processing status
- **ImageUploadListener**: Modified to delete `ImageUpload` record after successful processing
- **API Routes**: Added `GET /api/image-upload/{id}/status` route with authentication
### Status Polling Logic
- **Processing State**: Returns `processing` status when `ImageUpload` exists
- **Processed State**: Returns `processed` status with `AvailableImage` details when processing complete
- **Not Found State**: Returns `not_found` status when neither record exists
### Testing
- **Integration Tests**: Complete workflow testing from upload to status polling
- **Feature Tests**: Unit-level testing of status endpoint behavior
- **Anonymous Tests**: Authentication requirement verification
### Documentation
- **API Documentation**: Updated with ImageUpload model and status polling endpoint
- **Client Guide**: Comprehensive usage examples with JavaScript and React
- **Changelog**: Documented new feature and breaking changes
## Technical Details
### API Endpoints
- `GET /api/image-upload/{id}/status` - Check processing status
- Returns JSON with `status` and `available_image` fields
- Requires authentication via Bearer token
### Status Values
- `processing`: Image is being processed (ImageUpload exists)
- `processed`: Processing complete (AvailableImage exists)
- `not_found`: No record found with given ID
### Breaking Changes
- ImageUpload records are now deleted after successful processing
- This maintains the same ID tracking but cleans up temporary records
## Testing Results
- All 1047 tests passing
- New integration and feature tests added
- Existing workflow tests confirmed working
- Authentication tests verified
## Compliance
- Follows Laravel 12 best practices
- Uses proper resource controllers and middleware
- Implements comprehensive error handling
- Includes proper PHPDoc annotations
Co-authored-by: Pascal HAVELANGE <havelangep@hotmail.com>
Files Changed
- 📝 Modified:
CHANGELOG.md
- 📝 Modified:
api-client/.openapi-generator/FILES
- 📝 Modified:
api-client/api.ts
- 📝 Modified:
api-client/docs/ImageUploadApi.md
- ✅ Added:
api-client/docs/ImageUploadStatus200Response.md
- ✅ Added:
api-client/docs/ImageUploadStatus200ResponseAnyOf.md
- ✅ Added:
api-client/docs/ImageUploadStatus200ResponseAnyOf1.md
- ✅ Added:
api-client/docs/ImageUploadStatus404Response.md
- 📝 Modified:
app/Http/Controllers/ImageUploadController.php
- 📝 Modified:
app/Listeners/ImageUploadListener.php
- 📝 Modified:
docs/_openapi/api.json
- ✅ Added:
docs/api-client/image-upload-status-polling.md
- 📝 Modified:
docs/api-models.md
- 📝 Modified:
routes/api.php
- 📝 Modified:
tests/Feature/Api/ImageUpload/AnonymousTest.php
- ✅ Added:
tests/Feature/Api/ImageUpload/StatusTest.php
- ✅ Added:
tests/Integration/Api/ImageUpload/ImageUploadStatusPollingIntegrationTest.php
Links
This documentation was automatically generated from Git commit data.