Major Features Added:
1. Delete Files from Box After Upload
- After successful DAM upload, delete file from Box
- Prevents reprocessing same files
- Keeps Box folder clean
- Only deletes on success (keeps on failure for retry)
2. Email Notification for Each Upload
- New template: a2_to_a3_file_uploaded
- Sends email immediately after each successful upload
- Includes: filename, clean filename, asset ID, tracking ID
- Don't wait for "all done" - notify per file
- Recipients: configured in .env (REPORT_EMAILS)
3. Log Rotation for Both Scripts
- Uses RotatingFileHandler
- Max file size: 10MB per log file
- Backup count: 28 files (approximately 1 month)
- Auto-rotates when log reaches 10MB
- Keeps logs/a1_to_a2.log (current)
- Backups: logs/a1_to_a2.log.1, .2, .3, etc.
- Automatically deletes logs older than 28 rotations
- Applied to both A1→A2 and A2→A3 scripts
Flow Changes:
A2→A3 now:
1. Poll Box folder
2. Find V2 files
3. Download from Box
4. Upload to DAM
5. Delete from Box ✅ NEW
6. Send email notification ✅ NEW
7. Store derivative record
8. Exit
Log Management:
- Active logs: ~10MB max
- Rotated backups: 28 files = ~280MB total
- Automatic cleanup (no manual intervention needed)
- 1 week of detailed logs + 3 weeks of backups
Database:
- Added dam_asset_id and upload_status columns to derivative_assets
- Fixed store_derivative_asset() to use existing schema columns
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>