Every order created after orderheaderid 146119 had zero rows in orderdetails — the header saved fine but items never made it in, which also meant the stock pre-validation loop (it iterates over data.Items) never ran, so an order could go through without ever checking stock. Root cause: whichever client is sending these sends items as a sibling of "orders" rather than nested inside it, a shape neither existing parse strategy captures, so encoding/json silently dropped it. Add a third parse fallback for that sibling-items shape, and reject any order with zero items outright instead of letting it through as a phantom header-only row. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
14 KiB
14 KiB