IMPORVE ONBOARDING STEPS

This commit is contained in:
Urtzi Alfaro
2025-11-09 09:22:08 +01:00
parent 4678f96f8f
commit cbe19a3cd1
27 changed files with 2801 additions and 1149 deletions

View File

@@ -1062,9 +1062,12 @@ class InventoryService:
async def _validate_ingredient_data(self, ingredient_data: IngredientCreate, tenant_id: UUID):
"""Validate ingredient data for business rules"""
# Add business validation logic here
if ingredient_data.reorder_point <= ingredient_data.low_stock_threshold:
raise ValueError("Reorder point must be greater than low stock threshold")
# Only validate reorder_point if both values are provided
# During onboarding, these fields may be None, which is valid
if (ingredient_data.reorder_point is not None and
ingredient_data.low_stock_threshold is not None):
if ingredient_data.reorder_point <= ingredient_data.low_stock_threshold:
raise ValueError("Reorder point must be greater than low stock threshold")
# Storage requirements validation moved to stock level (not ingredient level)
# This is now handled in stock creation/update validation