Bin locations
Controller. bin-location.controller.ts. Base path /v1/operations/bin-location.
| Call | Use |
|---|---|
POST / | Create one bin |
POST /bulk | Create many |
GET /layout-summary/:warehouseId | Layout summary |
PUT /:id and DELETE /:id | Update and delete |
The controller tag in source is public.bin-location. That name is not @PublicRoute. The file has no @RequirePermissions and no @TenantScoped. The access JWT still applies. A missing permission decorator allows any authenticated user, subject to the warehouse guard.
Where a bin is checked
| Flow | Rule |
|---|---|
| Return restock | restoredToBinId must be in the return warehouse and tenant, and status must not be BLOCKED |
| Pick | A stocked line requires pickedFromBinId. On-hand in that bin must cover the new pick. See Pick and pack |
| Routing | Bins are not chosen by WarehouseRouterService. That service chooses a warehouse |
deriveBinStatus is a display helper, not a stored transition map. BLOCKED and UNAVAILABLE stay BLOCKED. Otherwise capacity reached is FULL, then RESERVED when reserved units are greater than 0, then LOW_STOCK, then OCCUPIED, otherwise EMPTY.
Delete
delete loads the bin with its stocks. A missing bin is binLocation.error.binNotFound. Any related stock row throws binLocation.error.binIsNotEmpty. An empty bin is removed with Prisma delete, not deletedAt.
Bin codes are built at creation from aisle, rack, shelf, and bin, uppercased and joined with hyphens. Zone defaults to MAIN. Location type defaults to PICK when the value is not a BinLocationType.