Warehouse API
Cheat sheet for catalog, warehouses, stock, transfers, and POS-catalog admin helpers. Routes: backend-main/warehouse/urls.py (mounted under /api/ via config/urls.py (backend-main/config/urls.py)). Narrative README (partially overlapping): backend-main/warehouse/README.md.
Auth: JWT Bearer. ViewSets / manage views use IsStockUser (backend-main/users/permissions.py) (staff/superuser or profile role stock) — see warehouse/views.py (backend-main/warehouse/views.py).
Router resources
| Method | Path | Purpose |
|---|---|---|
| CRUD | /api/categories/ | Product categories |
| CRUD | /api/pricing-categories/ | Pricing categories |
| CRUD | /api/products/ | Products (search/filters on ViewSet) |
| CRUD | /api/product-properties/keys/ | Property keys; nested …/keys/{id}/values/ |
| CRUD | /api/product-properties/values/ | Property values |
| CRUD | /api/warehouses/ | Warehouses (+ list stats) |
| list / create / retrieve | /api/stock-transfers/ | Transfers between warehouses |
Warehouse stock actions
On WarehouseViewSet (warehouse/views.py (backend-main/warehouse/views.py)):
| Method | Path | Purpose |
|---|---|---|
GET | /api/warehouses/{id}/products/ | Products + stock in warehouse |
POST | /api/warehouses/{id}/products/assign/ | Body: { "product_ids": […] } |
DELETE | /api/warehouses/{id}/products/{product_id}/ | Unassign product |
POST | /api/warehouses/{id}/products/{product_id}/adjust-stock/ | Body: { "adjustment", "reason" } |
GET | /api/warehouses/{id}/products/{product_id}/history/ | Stock history |
GET | /api/warehouses/{id}/stock-levels/ | Stock levels helper |
GET | /api/warehouses/{id}/delete-impact/ | Pre-delete impact |
GET | /api/warehouses/suggest-slug/ | Slug suggestion (list action) |
Transfer create body shape (from README / create serializer usage):
POST /api/stock-transfers/
{
"source_warehouse_id": 1,
"destination_warehouse_id": 2,
"items": [
{"product_id": 10, "quantity": 5}
],
"reason": "Restocking shop inventory"
}
Reference numbers are generated as TRNSF-{timestamp} (README). Stock ops use transactions; negative stock blocked by validation.
Other warehouse paths
| Method | Path | Purpose |
|---|---|---|
POST | /api/upload-image/ | Multipart image upload |
POST/GET… | /api/pos-catalog/manage/ | Bulk POS catalog product flags |
GET/… | /api/pos-catalog/manage/categories/ | Category summary for catalog manage |
… | /api/pos-catalog/manage/design-collections/ | Design collections catalog manage |
… | /api/pos-catalog/banners/manage/ | POS catalog banners |
… | /api/pos-catalog/offers/manage/ | POS catalog offers |
These are admin/stock JWT routes that configure what the POS terminal later reads via /api/pos-catalog/ (access key) — not the public POS catalog itself.
Models (quick)
Documented in README and domain model: Product, Warehouse, WarehouseStock, StockHistoryEntry, StockTransfer / StockTransferItem.