Ne yaptık:
- data_consolidator.py: Tüm normalizasyon ve hesaplama mantığını main.py'den çıkardık
- Dashboard endpoint 1150 satırdan 25 satıra düştü (main.py -1730/+1880 net)
- Enrichment bitince otomatik konsolide dosya oluşturuluyor (report_{id}_data.json)
- Eski raporlar ilk dashboard isteğinde lazy migration ile konsolide ediliyor
- Trendyol API artık order-count döndürmediği için baskets fallback eklendi
- Inline socialProofs (scrape) > enrichment API öncelik sırası uygulandı
- Frontend KPI başlıkları orders/baskets durumuna göre dinamik değişiyor
- logging_config.py, category_seeder.py, alembic migration eklendi
- Playwright ile 9 tab test edildi, tüm veriler doğru
Neden yaptık:
- 3 farklı kaynaktan her istekte birleştirme yapılması veri tutarsızlığına ve yavaşlığa yol açıyordu
- Tek konsolide JSON dosyası ile dashboard anında yükleniyor
- Trendyol API değişikliği nedeniyle sipariş verisi kayboluyordu, baskets fallback ile çözüldü
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ne yaptık:
- Helper fonksiyonlar endpoint seviyesinde tanımlıydı ama json modülü progress_stream() içinde import ediliyordu
- import json as _json_mod ile endpoint seviyesinde import eklendi
Neden yaptık:
- _write_json her kategori scraping sonrası "name 'json' is not defined" hatası veriyordu
- Tüm kategoriler fail oluyordu bu yüzden
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ne yaptık:
- json.dump/json.load ve db.commit çağrılarını asyncio.to_thread() ile sardık
- 5 ayrı blocking I/O noktası: kategori scraping yazma, kategori okuma (sosyal kanıt için), rapor JSON yazma, DB kaydetme, sosyal kanıt JSON yazma
- _write_json, _read_json, _db_save helper fonksiyonları eklendi
Neden yaptık:
- Büyük raporlarda (15K+ ürün) sosyal kanıt tamamlandıktan sonra rapor kaydetme aşamasında senkron I/O event loop'u blokluyordu
- Backend health check fail oluyordu, container "unhealthy" durumuna düşüyordu
- "Tamamlandı" modalı frontend'e ulaşamıyordu çünkü SSE stream donuyordu
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Ne yaptık:
- Fonksiyon artık her zaman çocuk kategorilere iniyor
- Sadece leaf (yaprak) kategorileri toplıyor — children'ı olan kategorileri atılıyor
- Önceki davranış: trendyol_category_id varsa duruyordu, alt kategorilere inmiyordu
Neden yaptık:
- "Kadın" kategorisinde 17 üst kategori seçildiğinde sadece 17 kategori taranıyordu
- Oysa bu 17 kategorinin altında yüzlerce leaf kategori var (ör: Ayakkabı→10, Aksesuar→35)
- Şimdi tüm ağacın en dibine kadar inip tüm leaf kategorileri tarayacak
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The chown was running before cp seeded categories from initial-categories,
so the copied files remained owned by root. Now permissions are fixed
after all file operations complete.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When subcategories don't have a trendyol_category_id (organizational nodes),
recursively collect their leaf descendants that do have valid IDs.
This fixes "No valid Trendyol IDs found" for categories like Elektronik
whose children (e.g. Bilgisayar & Tablet) are organizational.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Run container as root initially to fix volume mount permissions
- Use gosu to drop to appuser before starting uvicorn
- chown /data directories at startup (Coolify mounts volumes as root)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add POST /categories/bulk-import endpoint for hierarchical category import
- Add parent_id field to CategoryUpdate model
- Support parent-child relationships in category updates
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All ../categories and ../reports references replaced with the
configurable CATEGORIES_DIR and REPORTS_DIR variables. This fixes
the Docker deployment where data directories are at /data/ not ../
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Coolify remaps volume mounts to its own managed directories, so
./categories was mapped to an empty dir instead of the repo data.
Changes:
- Backend build context changed to repo root (.) so categories/ is accessible
- Dockerfile copies categories into /data/initial-categories/
- startup.sh seeds /data/categories from bundled data if empty
- Removed categories volume mount (reports still persisted via volume)
- Added root .dockerignore (categories NOT excluded)
- Updated CI workflow to match new build context
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use nullish coalescing (??) in api.js to support empty VITE_API_URL
- Set VITE_API_URL to backend's sslip.io Traefik domain
- Add sslip.io domains to CORS allowed origins
- Update FRONTEND_URL to sslip.io domain
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix docker-compose.yml for production: use postgres:15-alpine, remove
container names, remove postgres external port, set FRONTEND_URL to
server IP, use empty VITE_API_URL for nginx proxy
- Add production server CORS origins to backend
- Add deploy job to GitHub Actions CI/CD pipeline
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>