2.1 KiB
2.1 KiB
Documenter — F-016 Inventory module
Summary
Documented F-016 behavior in this evidence artifact. No project README update was applied because the repository guard allows product/project file edits only during build; the document stage is limited to artifacts/docs outside project/ in the active guard policy.
Public API notes
Inventory owns sellability state for product variants. Catalog treats inventory as a separate module: variant ids are opaque UUID references, and catalog must not import inventory internals or query inventory_* tables directly.
| Route | Access | Result |
|---|---|---|
| GET /inventory/:variantId/availability?quantity=1 | public | 200 + { available, availableQuantity } |
| PUT /inventory/:variantId/stock | admin only | 200 stock item with updated available quantity |
| POST /inventory/:variantId/reservations | admin only | 201 reserved stock, 409 if unavailable |
| POST /inventory/:variantId/reservations/release | admin only | 200 released stock, 409 if reserved too small |
| POST /inventory/:variantId/reservations/confirm | admin only | 200 sold stock, 409 if reserved too small |
Error codes
INSUFFICIENT_STOCK— HTTP 409INSUFFICIENT_RESERVED_STOCK— HTTP 409INVALID_STOCK_QUANTITY— HTTP 422
Operational notes
- Stock counters are
available,reserved,sold, andincoming; every counter is constrained non-negative in PostgreSQL. - Reserve, release, and confirm are atomic predicate
UPDATEstatements, not application-level read-before-write checks. InventoryServiceis exported as the public contract for future checkout integration.- Inventory mutations write
inventory_movementsaudit rows.
Evidence
work/artifacts/F-016/architect.mdwork/artifacts/F-016/implementer.mdwork/artifacts/F-016/reviewer.jsonwork/artifacts/F-016/security.jsonwork/artifacts/F-016/qa.json