Fix new services implementation 3

This commit is contained in:
Urtzi Alfaro
2025-08-14 16:47:34 +02:00
parent 0951547e92
commit 03737430ee
51 changed files with 657 additions and 982 deletions

View File

@@ -56,7 +56,7 @@ async def create_enhanced_single_forecast(
logger.info("Generating enhanced single forecast",
tenant_id=tenant_id,
product_name=request.product_name,
inventory_product_id=request.inventory_product_id,
forecast_date=request.forecast_date.isoformat())
# Record metrics
@@ -124,13 +124,13 @@ async def create_enhanced_batch_forecast(
logger.info("Generating enhanced batch forecasts",
tenant_id=tenant_id,
products_count=len(request.products),
forecast_dates_count=len(request.forecast_dates))
products_count=len(request.inventory_product_ids),
forecast_dates_count=request.forecast_days)
# Record metrics
if metrics:
metrics.increment_counter("enhanced_batch_forecasts_total")
metrics.histogram("enhanced_batch_forecast_products_count", len(request.products))
metrics.histogram("enhanced_batch_forecast_products_count", len(request.inventory_product_ids))
# Generate batch forecasts using enhanced service
batch_result = await enhanced_forecasting_service.generate_batch_forecasts(
@@ -174,7 +174,7 @@ async def create_enhanced_batch_forecast(
@track_execution_time("enhanced_get_forecasts_duration_seconds", "forecasting-service")
async def get_enhanced_tenant_forecasts(
tenant_id: str = Path(..., description="Tenant ID"),
product_name: Optional[str] = Query(None, description="Filter by product name"),
inventory_product_id: Optional[str] = Query(None, description="Filter by inventory product ID"),
start_date: Optional[date] = Query(None, description="Start date filter"),
end_date: Optional[date] = Query(None, description="End date filter"),
skip: int = Query(0, description="Number of records to skip"),
@@ -203,7 +203,7 @@ async def get_enhanced_tenant_forecasts(
# Get forecasts using enhanced service
forecasts = await enhanced_forecasting_service.get_tenant_forecasts(
tenant_id=tenant_id,
product_name=product_name,
inventory_product_id=inventory_product_id,
start_date=start_date,
end_date=end_date,
skip=skip,
@@ -218,7 +218,7 @@ async def get_enhanced_tenant_forecasts(
"forecasts": forecasts,
"total_returned": len(forecasts),
"filters": {
"product_name": product_name,
"inventory_product_id": inventory_product_id,
"start_date": start_date.isoformat() if start_date else None,
"end_date": end_date.isoformat() if end_date else None
},