Inventory (v1.0.0)

Tracks stock levels and availability for products.

Overview

The Inventory entity manages stock levels and availability for products in the e-commerce system. It tracks current quantities, reserved stock, and provides reorder management capabilities.

Entity Properties

NameTypeRequiredDescription
inventoryIdUUIDRequiredUnique identifier for the inventory record
productIdUUIDRequiredProduct this inventory record tracks
skustringRequiredStock Keeping Unit matching the product SKU
quantityOnHandintegerRequiredCurrent available stock quantity
quantityReservedintegerRequiredQuantity reserved for pending orders
quantityAvailableintegerRequiredCalculated available quantity (onHand - reserved)
minimumStockLevelintegerRequiredMinimum stock level before reorder alert
maximumStockLevelintegerOptionalMaximum stock level for inventory management
reorderPointintegerRequiredStock level that triggers reorder process
reorderQuantityintegerRequiredQuantity to order when restocking
unitCostdecimalOptionalCost per unit for inventory valuation
warehouseLocationstringOptionalPhysical location or bin where item is stored
lastRestockedAtDateTimeOptionalDate and time of last restock
lastSoldAtDateTimeOptionalDate and time of last sale
isTrackingEnabledbooleanRequiredWhether inventory tracking is enabled for this product
backorderAllowedbooleanRequiredWhether backorders are allowed when out of stock
createdAtDateTimeRequiredDate and time when the inventory record was created
updatedAtDateTimeOptionalDate and time when the inventory record was last updated

Relationships

  • Product: Each inventory record belongs to one Product (identified by productId).
  • OrderItem: Inventory quantities are affected by OrderItem entities when orders are placed.

Stock Calculations

  • Available Quantity = Quantity On Hand - Quantity Reserved
  • Reorder Needed = Quantity Available <= Reorder Point
  • Stock Value = Quantity On Hand × Unit Cost

Examples

  • Inventory #1: iPhone 15 Pro - 25 on hand, 5 reserved, 20 available, reorder at 10 units.
  • Inventory #2: Running Shoes Size 9 - 0 on hand, 2 reserved, backorder allowed.

Business Rules

  • Quantity on hand cannot be negative
  • Quantity reserved cannot exceed quantity on hand
  • Available quantity is automatically calculated
  • Reorder alerts are triggered when available = reorder point
  • Stock reservations are created when orders are placed
  • Stock is decremented when orders are shipped
  • Inventory adjustments must be logged for audit trail