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