Start integrating the onboarding flow with backend 11
This commit is contained in:
@@ -36,7 +36,7 @@ const convertProductsToInventory = (approvedProducts: any[]): InventoryItem[] =>
|
||||
current_stock: 0, // To be configured by user
|
||||
min_stock: 1, // Default minimum
|
||||
max_stock: 100, // Default maximum
|
||||
unit: product.unit_of_measure || 'unidad',
|
||||
unit: product.unit_of_measure || 'units',
|
||||
requires_refrigeration: product.requires_refrigeration || false,
|
||||
// Store API data
|
||||
suggestion_id: product.suggestion_id,
|
||||
|
||||
@@ -100,7 +100,7 @@ export const ReviewStep: React.FC<OnboardingStepProps> = ({
|
||||
confidence: 50,
|
||||
status: 'pending' as const,
|
||||
product_type: 'finished_product' as const,
|
||||
unit_of_measure: 'unidad',
|
||||
unit_of_measure: 'units',
|
||||
estimated_shelf_life_days: 7,
|
||||
requires_refrigeration: false,
|
||||
requires_freezing: false,
|
||||
|
||||
@@ -108,10 +108,10 @@ export const useInventorySetup = () => {
|
||||
name: suggestion.suggested_name || suggestion.original_name,
|
||||
category: suggestion.category || 'Sin categoría',
|
||||
description: suggestion.notes || '',
|
||||
unit_of_measure: suggestion.unit_of_measure || 'unidad',
|
||||
minimum_stock_level: 1, // Default minimum stock
|
||||
maximum_stock_level: 100, // Default maximum stock
|
||||
reorder_point: 5, // Default reorder point
|
||||
unit_of_measure: suggestion.unit_of_measure || 'units',
|
||||
low_stock_threshold: 10, // Default low stock threshold
|
||||
reorder_point: 15, // Default reorder point (must be > low_stock_threshold)
|
||||
reorder_quantity: 50, // Default reorder quantity
|
||||
shelf_life_days: suggestion.estimated_shelf_life_days || 30,
|
||||
requires_refrigeration: suggestion.requires_refrigeration || false,
|
||||
requires_freezing: suggestion.requires_freezing || false,
|
||||
|
||||
@@ -72,15 +72,10 @@ async def create_ingredient(
|
||||
async def get_ingredient(
|
||||
ingredient_id: UUID,
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
current_user: dict = Depends(get_current_user_dep),
|
||||
db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
"""Get ingredient by ID"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
service = InventoryService()
|
||||
ingredient = await service.get_ingredient(ingredient_id, tenant_id)
|
||||
|
||||
@@ -105,15 +100,10 @@ async def update_ingredient(
|
||||
ingredient_id: UUID,
|
||||
ingredient_data: IngredientUpdate,
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
current_user: dict = Depends(get_current_user_dep),
|
||||
db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
"""Update ingredient"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
try:
|
||||
service = InventoryService()
|
||||
ingredient = await service.update_ingredient(ingredient_id, ingredient_data, tenant_id)
|
||||
|
||||
@@ -149,14 +139,10 @@ async def list_ingredients(
|
||||
is_low_stock: Optional[bool] = Query(None, description="Filter by low stock status"),
|
||||
needs_reorder: Optional[bool] = Query(None, description="Filter by reorder needed"),
|
||||
search: Optional[str] = Query(None, description="Search in name, SKU, or barcode"),
|
||||
current_user: dict = Depends(get_current_user_dep),
|
||||
db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
"""List ingredients with filtering"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
service = InventoryService()
|
||||
|
||||
@@ -188,14 +174,10 @@ async def list_ingredients(
|
||||
async def delete_ingredient(
|
||||
ingredient_id: UUID,
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
current_user: dict = Depends(get_current_user_dep),
|
||||
db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
"""Soft delete ingredient (mark as inactive)"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
service = InventoryService()
|
||||
ingredient = await service.update_ingredient(
|
||||
@@ -225,14 +207,10 @@ async def get_ingredient_stock(
|
||||
ingredient_id: UUID,
|
||||
tenant_id: UUID = Path(..., description="Tenant ID"),
|
||||
include_unavailable: bool = Query(False, description="Include unavailable stock"),
|
||||
current_user: dict = Depends(get_current_user_dep),
|
||||
db: AsyncSession = Depends(get_db)
|
||||
):
|
||||
"""Get stock entries for an ingredient"""
|
||||
try:
|
||||
# Verify tenant access
|
||||
if str(tenant_id) != current_tenant:
|
||||
raise HTTPException(status_code=403, detail="Access denied to this tenant")
|
||||
|
||||
service = InventoryService()
|
||||
stock_entries = await service.get_stock_by_ingredient(
|
||||
|
||||
Reference in New Issue
Block a user