feat: Enhanced Picture Management with Detachment System and CI/CD Improvements (#207)
Commit: 94909d7c4d8ce23e57896e4b09d4a00e27eef308
Date: 2025-07-08 23:01:35 +0000
Author: PascalHavelange
Commit Message
feat: Enhanced Picture Management with Detachment System and CI/CD Improvements (#207)
* Adding temp_*.md to .gitignore
Adding a copilot-instruction for git commit and pr messages
* # Fix migration rollback methods for proper database schema reversibility
## Summary
Fixed multiple migration rollback methods that were incomplete or incorrect, ensuring that database schema changes can be properly reversed when rolling back migrations.
## Changes Made
### Fixed Migration Rollback Issues:
- **2025_06_16_191140_update_picture_model.php**: Fixed rollback to recreate proper table structure with correct primary key type (id instead of string) and missing timestamps
- **2025_06_16_195427_update_picture_model_path_nullable.php**: Added explicit `nullable(false)` to rollback method to properly reverse the nullable change
- **2025_06_24_101559_change_language_backward_compatibility_to_nullable.php**: Added explicit `nullable(false)` to rollback method
- **2025_06_24_101702_change_country_backward_compatibility_to_nullable.php**: Added explicit `nullable(false)` to rollback method
- **2025_07_06_135928_drop_old_language_tables.php**: Implemented complete rollback by recreating all four dropped language tables (contact_language, location_language, province_language, address_language) with proper structure and foreign key constraints
- **2025_07_08_000001_drop_pictures_table.php**: Added table existence check to prevent conflicts during rollback and ensure proper table recreation with all required fields
- **2025_07_08_191115_create_polymorphic_pictures_table.php**: Fixed rollback to recreate the previous table structure instead of just dropping the table
## Technical Details
- All rollback methods now properly reverse their corresponding `up()` operations
- Added missing Blueprint import where needed
- Fixed primary key types and nullable constraints
- Ensured foreign key constraints are properly recreated during rollback
- Added table existence checks to prevent rollback conflicts
- Tested rollback operations to ensure they work correctly
## Testing
- All migration rollbacks have been tested and work correctly
- No breaking changes to existing functionality
- Maintains database schema integrity during rollback operations
* feat: add picture detach functionality with comprehensive testing
This commit introduces the ability to detach pictures from items, details, and partners through new API endpoints.
## Changes:
- Add detach endpoints in PictureController for items, details, and partners
- Update ImageUploadListener to handle picture detachment events
- Add new API routes for picture detachment operations
- Implement comprehensive test coverage for detach functionality
- Add integration tests for complete picture workflow
- Update existing tests to reflect new functionality
## API Endpoints:
- DELETE /api/pictures/{picture}/detach-from-item/{item}
- DELETE /api/pictures/{picture}/detach-from-detail/{detail}
- DELETE /api/pictures/{picture}/detach-from-partner/{partner}
## Test Coverage:
- Anonymous access tests for detach endpoints
- Feature tests for each detach operation
- Integration tests for complete picture workflow
- Event listener tests for picture detachment
This enhancement provides users with the ability to manage picture associations more effectively, allowing for flexible content organization and management.
* feat: enhance CI scripts and update documentation
This commit improves the CI/CD pipeline with enhanced scripts and comprehensive documentation updates.
## CI Scripts Enhancements:
- Add new PowerShell scripts for CI operations in `scripts/` directory
- Update composer.json with improved CI script definitions
- Update package.json with additional dev dependencies and scripts
- Enhance pre-push hooks for better code quality checks
## Documentation Updates:
- Update CHANGELOG.md with latest changes and improvements
- Enhance README.md with better setup and usage instructions
- Update copilot-instructions.md with refined coding guidelines
- Refresh API documentation in docs/_openapi/api.json
- Update coding guidelines in docs/guidelines/
## Key Improvements:
- Better error handling in CI scripts
- More comprehensive testing workflows
- Enhanced code quality checks
- Improved developer experience with clearer documentation
- Updated API documentation reflecting new endpoints
This enhancement streamlines the development workflow and provides better tooling for maintaining code quality and consistency across the project.
* docs: update documentation to reflect picture detachment and CI script enhancements
This commit updates comprehensive project documentation to reflect the latest features and improvements.
## Documentation Updates:
### README.md Enhancements:
- **Picture Detachment Endpoints**: Added documentation for new detachment API endpoints
- `DELETE /api/picture/{picture}/detach-from-item/{item}`
- `DELETE /api/picture/{picture}/detach-from-detail/{detail}`
- `DELETE /api/picture/{picture}/detach-from-partner/{partner}`
- **Enhanced Image Workflow**: Updated workflow documentation to include detachment step
- **CI Script Documentation**: Added section for enhanced PowerShell CI scripts
- Documented new scripts in `scripts/` directory
- Explained argument passing and error handling improvements
- Added examples for flexible testing and linting workflows
### CHANGELOG.md Corrections:
- **Fixed Endpoint Paths**: Corrected picture detachment endpoint documentation
- **Added CI Script Section**: Documented PowerShell script enhancements
- New `ci-test.ps1`, `ci-test-with-filter.ps1`, `ci-lint.ps1`, `ci-lint-with-args.ps1`
- Environment variable support (`COMPOSER_ARGS`)
- Enhanced error handling and developer experience
### API Documentation Updates:
- **docs/api-documentation.md**: Updated workflow to include picture detachment step
- **docs/index.md**: Added mention of CI/CD script enhancements
- **docs/guidelines/coding-guidelines.md**: Enhanced CI script usage examples
- Added PowerShell script documentation
- Included flexible argument passing examples
- Documented enhanced testing and linting capabilities
### Copilot Instructions Updates:
- **Updated coding guidelines**: Enhanced instructions for CI script usage
- **Improved development workflow**: Better guidance for testing and linting
## Key Improvements:
- Complete documentation coverage for picture detachment functionality
- Comprehensive CI script enhancement documentation
- Better developer experience with clearer usage examples
- Consistent documentation across all markdown files
- Updated workflow diagrams and endpoint listings
This ensures all documentation accurately reflects the current state of the application and provides clear guidance for developers working with the new features.
---------
Co-authored-by: Pascal HAVELANGE <havelangep@hotmail.com>
Files Changed
- 📝 Modified:
.github/copilot-instructions.md
- 📝 Modified:
.gitignore
- 📝 Modified:
.husky/pre-push
- 📝 Modified:
CHANGELOG.md
- 📝 Modified:
README.md
- 📝 Modified:
app/Http/Controllers/PictureController.php
- 📝 Modified:
app/Listeners/ImageUploadListener.php
- 📝 Modified:
composer.json
- 📝 Modified:
database/migrations/2025_06_16_191140_update_picture_model.php
- 📝 Modified:
database/migrations/2025_06_16_195427_update_picture_model_path_nullable.php
- 📝 Modified:
database/migrations/2025_06_24_101559_change_language_backward_compatibility_to_nullable.php
- 📝 Modified:
database/migrations/2025_06_24_101702_change_country_backward_compatibility_to_nullable.php
- 📝 Modified:
database/migrations/2025_07_06_135928_drop_old_language_tables.php
- 📝 Modified:
database/migrations/2025_07_08_000001_drop_pictures_table.php
- 📝 Modified:
database/migrations/2025_07_08_191115_create_polymorphic_pictures_table.php
- 📝 Modified:
docs/_openapi/api.json
- 📝 Modified:
docs/api-documentation.md
- 📝 Modified:
docs/guidelines/coding-guidelines.md
- 📝 Modified:
docs/index.md
- 📝 Modified:
package.json
- 📝 Modified:
routes/api.php
- ✅ Added:
scripts/ci-lint-with-args.ps1
- ✅ Added:
scripts/ci-lint.ps1
- ✅ Added:
scripts/ci-test-with-filter.ps1
- ✅ Added:
scripts/ci-test.ps1
- 📝 Modified:
tests/Feature/Api/Picture/AnonymousTest.php
- 📝 Modified:
tests/Feature/Api/Picture/AttachToItemTest.php
- ✅ Added:
tests/Feature/Api/Picture/DetachFromDetailTest.php
- ✅ Added:
tests/Feature/Api/Picture/DetachFromItemTest.php
- ✅ Added:
tests/Feature/Api/Picture/DetachFromPartnerTest.php
- ✅ Added:
tests/Feature/Api/Picture/PictureWorkflowIntegrationTest.php
- 📝 Modified:
tests/Feature/Event/AvailableImage/AvailableImageTest.php
- ✅ Added:
tests/Integration/Api/Picture/PictureWorkflowIntegrationTest.php
Links
This documentation was automatically generated from Git commit data.