Improve AI logic

This commit is contained in:
Urtzi Alfaro
2025-11-05 13:34:56 +01:00
parent 5c87fbcf48
commit 394ad3aea4
218 changed files with 30627 additions and 7658 deletions

View File

@@ -305,6 +305,31 @@ async def reserve_capacity(
raise HTTPException(status_code=500, detail="Failed to reserve capacity")
@router.get(
"/api/v1/tenants/{tenant_id}/production/capacity/date/{date}",
response_model=list
)
async def get_capacity_by_date(
tenant_id: UUID = Path(...),
date: date = Path(..., description="Date to retrieve capacity for (format: YYYY-MM-DD)"),
current_user: dict = Depends(get_current_user_dep),
production_service: ProductionService = Depends(get_production_service)
):
"""Get capacity by date (using direct route to support date path parameter)"""
try:
capacity_data = await production_service.get_capacity_by_date(tenant_id, date)
logger.info("Retrieved capacity by date",
tenant_id=str(tenant_id), date=date.isoformat())
return capacity_data
except Exception as e:
logger.error("Error getting capacity by date",
error=str(e), tenant_id=str(tenant_id), date=date.isoformat())
raise HTTPException(status_code=500, detail="Failed to get capacity by date")
@router.get(
route_builder.build_operations_route("capacity/bottlenecks"),
response_model=dict