Commit Graph

23 Commits

Author SHA1 Message Date
furkanyigit34
bb333208ab fix: Python 3.11 f-string syntax hatası (dict key erişimi)
Ne yaptık:
- f-string içindeki main_cat["name"] tırnak çakışmasını düzelttik
- Python 3.12+ destekler ama Docker'daki 3.11 desteklemiyor
- main_cat_name değişkenine atayarak çözdük

Neden yaptık:
- Production'da backend crash ediyordu (SyntaxError)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 02:33:04 +03:00
furkanyigit34
1c10a701cf feat: Miller Columns kategori seçici + JSON tree tabanlı mimari
Ne yaptık:
- Sahibinden.com tarzı Miller Columns kategori seçici (CategorySelector.jsx)
- Trendyol API'den 3971 kategori ağacı çekildi (Playwright ile)
- Backend: JSON tree tabanlı kategori endpoint'leri (/api/category-tree/*)
- Backend: Rapor oluşturma artık DB kategorilerine bağımlı değil
- Report tablosundaki category_id FK constraint kaldırıldı
- Dockerfile'a trendyol_category_tree.json eklendi

Neden yaptık:
- DB'deki kategori tablosu boştu, Trendyol API ID'leri ile Excel ID'leri farklıydı
- Playwright ile Trendyol'un kendi kategori ağacını çektik (3971 kategori, gerçek API ID'leri)
- Miller Columns ile kullanıcı adım adım derinleşerek kategori seçebiliyor
- Arama özelliği ile kelime bazlı kategori bulma da mümkün

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 02:24:22 +03:00
furkanyigit34
6aa4ec5eb0 fix: logging_config PermissionError in Docker container
Ne yaptık:
- /app/../logs yazılamadığında /tmp/logs'a fallback eklendi

Neden yaptık:
- Docker container'da /logs dizinine yazma izni olmadığı için backend başlatılamıyordu

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 22:36:00 +03:00
furkanyigit34
ce1dc1e25f feat: tek birleştirilmiş JSON yapısına geçiş + sosyal kanıt fallback
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>
2026-03-28 22:25:25 +03:00
furkanyigit34
187c59ec9b fix: json module not in scope for _write_json/_read_json helpers
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>
2026-03-27 18:14:18 +03:00
furkanyigit34
1baaa6fbce fix: move blocking file I/O to threads to prevent event loop stall
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>
2026-03-27 18:01:40 +03:00
furkanyigit34
dc1f8fcfb2 fix: SSE timeout during social proof collection
Ne yaptık:
- time.sleep() → await asyncio.sleep() ile event loop bloklanması engellendi
- Sosyal kanıt batch size 5 → 20 (1115 istek → 279 istek, %75 azalma)
- SSE keepalive heartbeat eklendi (her 10 batch'te bir)
- Nginx proxy timeout 180s → 600s (10 dakika)
- Rate limit sleep süreleri optimize edildi (2s→1.5s, 0.5s→0.3s)

Neden yaptık:
- Kadın kategorisi gibi büyük raporlarda (82 yaprak kategori, 5576 ürün)
  sosyal kanıt aşamasında SSE bağlantısı kopuyordu. Kök neden:
  senkron time.sleep() async generator içinde event loop'u blokluyor,
  proxy idle timeout'a takılıyor ve bağlantıyı kesiyordu.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 17:01:14 +03:00
furkanyigit34
f5562e2135 fix: collect_scrapable_categories should recurse to leaf categories
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>
2026-03-27 16:05:01 +03:00
furkanyigit34
974fe42064 fix: match Traefik service names with Coolify router names
Ne yaptık:
- Service label adlarını Coolify'ın oluşturduğu router adlarıyla eşleştirdik
- frontend: frontend → http-0-x4c08gc84kcw4oow0ggg44cg-frontend
- backend: backend → http-0-x4c08gc84kcw4oow0ggg44cg-backend

Neden yaptık:
- Traefik router adı ile service adı eşleşmediğinde 502 Bad Gateway dönüyordu
- Coolify router'ları kendi UUID formatında oluşturuyor, service adları da aynı formatta olmalı

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 15:46:56 +03:00
furkanyigit34
0147cbd37e fix: add Traefik port label for frontend service
Ne yaptık:
- Frontend service'ine traefik.http.services.frontend.loadbalancer.server.port=80 label'ı eklendi

Neden yaptık:
- Traefik frontend container'ın hangi portta çalıştığını bilmiyordu (502 Bad Gateway)
- Backend'de bu label vardı ama frontend'de eksikti

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 15:35:46 +03:00
furkanyigit34
b5d18f1d15 fix: "Tümünü Seç" tüm alt kategorileri seçmeli, sadece filtrelenenleri değil
Ne yaptık:
- "Tümünü Seç" artık arama filtresi aktifken bile tüm alt kategorileri seçiyor
- Tüm alt kategoriler seçiliyse subcategory_ids gönderilmiyor (backend zaten tümünü tarıyor)
- URL uzunluk limitine takılma riski ortadan kalktı
- Label'a seçili/toplam sayacı eklendi (ör: 45/105)

Neden yaptık:
- Kozmetik gibi 105 alt kategorili ana kategoride "Tümünü Seç" sadece
  filtrelenmiş kategorileri seçiyordu, bu yüzden raporda 1 kategori (~100 ürün)
  taranıyordu. Şimdi 105 kategori (~10.500 ürün) taranacak.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 15:25:03 +03:00
furkanyigit34
a9170bda83 fix: add Traefik SSE streaming support for backend
- flushInterval=100ms prevents Traefik from buffering SSE responses
- X-Accel-Buffering=no header disables proxy buffering
- Fixes SSE connection dropping during report generation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 02:07:21 +03:00
furkanyigit34
e3bed0a999 fix: add Traefik port label for backend service
Traefik defaults to port 80 when no loadbalancer port is specified.
Backend listens on 8001, causing the trendyol-api domain to timeout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 01:56:53 +03:00
furkanyigit34
bc9af71d17 fix: move permission fix after category seeding in startup.sh
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>
2026-03-08 01:44:08 +03:00
furkanyigit34
1bcb88a941 fix: recursively resolve categories without trendyol_category_id for report creation
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>
2026-03-08 01:13:22 +03:00
furkanyigit34
87d7ea88aa fix: resolve Permission denied for /data/reports in Coolify deployment
- 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>
2026-03-08 00:44:56 +03:00
furkanyigit34
344474e763 feat: add bulk category import endpoint and parent_id update support
- 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>
2026-03-08 00:35:10 +03:00
furkanyigit34
e6d47b89ee fix: use CATEGORIES_DIR and REPORTS_DIR env vars instead of hardcoded paths
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>
2026-03-07 23:45:21 +03:00
furkanyigit34
f85fb75830 fix: bundle categories into Docker image for Coolify deployment
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>
2026-03-07 23:32:34 +03:00
furkanyigit34
99a132879f fix: configure sslip.io domains for Coolify Traefik proxy
- 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>
2026-03-07 18:09:13 +03:00
furkanyigit34
0079313708 feat: configure Coolify deployment for production
- 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>
2026-03-07 17:45:01 +03:00
furkanyigit34
0d908a1afe feat: add 9 new dashboard features with export and comparison
- Add Hidden Champions tab with filterable product table
- Add Opportunity Map tab with scatter chart (supply/demand quadrants)
- Add Sales Funnel section to Overview with conversion rates
- Add Price Distribution histogram with mean/median lines
- Add Competition Score gauge (0-100) with 4 sub-metrics
- Add Excel export (3-sheet xlsx) and Print buttons to dashboard
- Add Report Comparison page with KPI diff table and brand bar chart
- Add enrichment UI to ReportList with progress tracking
- Add sidebar navigation with Karşılaştır route
- Refactor UI: Layout, Sidebar, TopBar, KpiCard, SkeletonLoader components
- Improve drill-down UX with visible pill buttons and tooltips

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 17:33:07 +03:00
furkanyigit34
c7be57064b Initial commit: Trendyol Analiz platform
- FastAPI backend with Python
- React + Vite admin panel
- PostgreSQL database
- Trendyol marketplace analytics
- GitHub Actions CI/CD workflow

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 00:14:38 +03:00