Malzeme Yazma — ingredients/create · update · delete ✓ Canlı

Malzeme/stok kartlarını yazar (oluştur/güncelle/sil). Alan adları ingredients/list okuma şekliyle simetriktir. Sahiplik/idempotency/hata/echo kuralları katalog yazma ile ortaktır.

← API Uçları · Ortak kurallar · Scope: ingredients:write.

ingredients/create

POST /plugin-api/ingredients/create
{
  "title": "Mozzarella",             // ZORUNLU (2..100)
  "unit": "kg",                      // ZORUNLU (<=32; kg/lt/adet…)
  "alert": 5,                        // ops — düşük-stok eşiği (>= 0)
  "tax": 10,                         // ops — KDV % (0..100)
  "idempotencyKey": "ing-1"          // ops
}
Stok/maliyet yazılamaz: stock (envanter hareketiyle değişir), ort (maliyet) ve depo kırılımı API'ye kapalı. Yeni malzeme stok 0 ile oluşur.

ingredients/update

POST /plugin-api/ingredients/update
{ "id": "x9-01", "alert": 10 }   // {id} + title/unit/alert/tax'tan en az biri

{ id } + title/unit/alert/tax'tan en az biri. Sahiplik kontrollü (notOwned).

ingredients/delete

POST /plugin-api/ingredients/delete
{ "id": "x9-01" }
// 200 → { "success": true, "data": { "id": "x9-01", "deleted": true } }

Sahiplik kontrollü.

Yanıt şekli (create/update)

ingredients/list ile aynı şekil: { id, title, unit, stock, alert, tax }.