📦 Envanter Yönetimi

API Uçları

REST API kullanım belgeleri

Ürünler

GET /api/products — Tüm ürünler (sayfa görünümü)
GET /api/products/api/all — JSON ürün listesi
POST /api/products — Yeni ürün ekle
GET /api/products/:id — Ürün detayı + hareket geçmişi
PUT /api/products/:id — Ürünü güncelle
DELETE /api/products/:id — Ürünü sil

Stok Hareketleri

POST /api/stock/in — Stok girişi {productId, quantity, note?}
POST /api/stock/out — Stok çıkışı (yetersizse 400)
GET /api/stock/movements?json=1 — Tüm hareket logları
GET /api/stock/movements/:productId — Ürüne özel hareketler

Kategoriler

GET /api/categories?json=1 — Tüm kategoriler + ürün sayısı
POST /api/categories — Kategori ekle {name}
PUT /api/categories/:id — Kategori güncelle
DELETE /api/categories/:id — Kategori sil (ürünü varsa engellenir)

Raporlar

GET /api/reports/api/category/:id?from=&to= — Kategori bazlı JSON rapor (id=all tümü)
GET /api/reports/api/all — Tüm kategori özetleri
GET /api/reports/category — Raporlama sayfası

Örnek — Stok Girişi

curl -X POST http://localhost:3000/api/stock/in \
  -H "Content-Type: application/json" \
  -d '{"productId": 1, "quantity": 10, "note": "Tedarikçi sevkiyatı"}'

← Panele Dön