ProBoard
Web development
Web developmentPublié 20 oct.

Inventory API accepts negative stock

`PUT /items/<sku>` stores a negative quantity instead of returning 400.

Description

Warehouse stock service (`inventory.py`, `app.py`). Problem: `PUT /items/<sku>` with `{"qty": -5}` is accepted and stored, which breaks every downstream report. `adjust` correctly refuses to go below zero. Expected: - setting a negative quantity returns `400` and does not store anything; - zero is allowed; - `adjust`, `GET /items` and the error format stay unchanged. Acceptance: `python -m unittest discover -s tests` passes. Message me, I'll send the repo and a sample request. Money goes out right after the fix is verified.

Compétences

  • Python
  • Flask
  • REST API