frontend


frontend / api/inventory/rowNormalizers / toInventoryRow

Function: toInventoryRow()

toInventoryRow(raw): InventoryRow | null

Defined in: 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

InventoryRow | null

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);