diff --git a/frontend/src/components/domain/onboarding/steps/UploadSalesDataStep.tsx b/frontend/src/components/domain/onboarding/steps/UploadSalesDataStep.tsx index 59d43cce..646a6f4b 100644 --- a/frontend/src/components/domain/onboarding/steps/UploadSalesDataStep.tsx +++ b/frontend/src/components/domain/onboarding/steps/UploadSalesDataStep.tsx @@ -455,13 +455,19 @@ export const UploadSalesDataStep: React.FC = ({ try { // Create all ingredients in parallel const creationPromises = inventoryItems.map(item => { + // Normalize unit to lowercase (backend requires lowercase) + const normalizedUnit = item.unit_of_measure.toLowerCase(); + + // Ensure max_stock_level is at least 1 (backend validation requires > 0) + const maxStockLevel = Math.max(1, item.stock_quantity * 2); + const ingredientData = { name: item.name, product_type: item.product_type, category: item.category, - unit_of_measure: item.unit_of_measure, + unit_of_measure: normalizedUnit, low_stock_threshold: item.low_stock_threshold, - max_stock_level: item.stock_quantity * 2, + max_stock_level: maxStockLevel, reorder_point: item.reorder_point, shelf_life_days: item.estimated_shelf_life_days, requires_refrigeration: item.requires_refrigeration,