frontend


frontend / api/inventory/rowNormalizers / toInventoryRow

Function: toInventoryRow()

toInventoryRow(raw): null | InventoryRow

Defined in: src/api/inventory/rowNormalizers.ts:38

Normalize a raw API response object into a strongly-typed InventoryRow. Maps backend fields:

  • id → itemId
  • quantity → onHand
  • minimumQuantity → minQty
  • createdAt → updatedAt

Parameters

raw

unknown

Raw DTO from API response

Returns

null | InventoryRow

InventoryRow with all fields safely extracted and coerced, or null if invalid

Example

const rows = response.content
  .map(toInventoryRow)
  .filter((r): r is InventoryRow => r !== null);