Proje: Okul.com.tr CRM · Hub: Okul.com.tr CRM — Incidents

Semptom

/sales/checkouts/basket sayfasında ürün dropdown’ı “#123” gibi ID gösteriyordu, ürün adı yerine. Frontend ?includes[]=product parametresi gönderiyor ama yanıtta product ilişkisi yüklenmemiş.

Root Cause

okulcom-api tarafında app/Http/Requests/Admin/Product/IndexProductPriceRequest.php::toDTO() includes alanını DTO’ya geçmiyor:

return new IndexProductPriceDTO(
    pageLength: ..., productId: ..., locationId: ..., schoolTypeId: ...,
    // includes: $this->input('includes', []) ← EKSİK
);

IndexProductPriceDTO constructor’ında public array $includes = [] parametresi mevcut, repository’de applyIncludes($query, $dto->includes) çağrılıyor ama toDTO geçmediği için her zaman boş array. Sonuç: hiçbir ilişki eager-load edilmiyor.

Workaround (Frontend)

src/pages/checkouts/basket.tsx içinde sayfa açılırken tüm ürünleri bir defa çekip productId → {name, isFree, productType} map’i oluşturuluyor (productsMapRef). loadProductPrices her ProductPrice fiyatını dropdown’a eklerken bu map’ten ürün adını çözüyor.

Ek filtreler aynı yerde:

  • product_type === 'listing' olmayanlar dropdown’a girmez
  • is_free === '1' (promosyon ürünler) dropdown’a girmez

Önerilen Fix (API)

IndexProductPriceRequest::toDTO() içine:

includes: (array) $this->input('includes', []),

satırı eklenmeli; allowed includes listesi ['product', 'schoolType', 'location'].

Durum

Frontend workaround uygulandı; ekibe API fix önerildi.