Imporve the predicciones page
This commit is contained in:
@@ -15,10 +15,11 @@ import {
|
||||
DeleteForecastResponse,
|
||||
GetForecastsParams,
|
||||
ForecastingHealthResponse,
|
||||
MultiDayForecastResponse,
|
||||
} from '../types/forecasting';
|
||||
|
||||
export class ForecastingService {
|
||||
private readonly baseUrl = '/forecasts';
|
||||
private readonly baseUrl = '/tenants';
|
||||
|
||||
/**
|
||||
* Generate a single product forecast
|
||||
@@ -29,7 +30,7 @@ export class ForecastingService {
|
||||
request: ForecastRequest
|
||||
): Promise<ForecastResponse> {
|
||||
return apiClient.post<ForecastResponse, ForecastRequest>(
|
||||
`/tenants/${tenantId}${this.baseUrl}/single`,
|
||||
`${this.baseUrl}/${tenantId}/forecasts/single`,
|
||||
request
|
||||
);
|
||||
}
|
||||
@@ -43,7 +44,7 @@ export class ForecastingService {
|
||||
request: BatchForecastRequest
|
||||
): Promise<BatchForecastResponse> {
|
||||
return apiClient.post<BatchForecastResponse, BatchForecastRequest>(
|
||||
`/tenants/${tenantId}${this.baseUrl}/batch`,
|
||||
`${this.baseUrl}/${tenantId}/forecasts/batch`,
|
||||
request
|
||||
);
|
||||
}
|
||||
@@ -75,8 +76,8 @@ export class ForecastingService {
|
||||
}
|
||||
|
||||
const queryString = searchParams.toString();
|
||||
const url = `/tenants/${tenantId}${this.baseUrl}${queryString ? `?${queryString}` : ''}`;
|
||||
|
||||
const url = `${this.baseUrl}/${tenantId}/forecasts${queryString ? `?${queryString}` : ''}`;
|
||||
|
||||
return apiClient.get<ForecastListResponse>(url);
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ export class ForecastingService {
|
||||
forecastId: string
|
||||
): Promise<ForecastByIdResponse> {
|
||||
return apiClient.get<ForecastByIdResponse>(
|
||||
`/tenants/${tenantId}${this.baseUrl}/${forecastId}`
|
||||
`${this.baseUrl}/${tenantId}/forecasts/${forecastId}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -102,7 +103,7 @@ export class ForecastingService {
|
||||
forecastId: string
|
||||
): Promise<DeleteForecastResponse> {
|
||||
return apiClient.delete<DeleteForecastResponse>(
|
||||
`/tenants/${tenantId}${this.baseUrl}/${forecastId}`
|
||||
`${this.baseUrl}/${tenantId}/forecasts/${forecastId}`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -114,7 +115,21 @@ export class ForecastingService {
|
||||
tenantId: string
|
||||
): Promise<ForecastStatistics> {
|
||||
return apiClient.get<ForecastStatistics>(
|
||||
`/tenants/${tenantId}${this.baseUrl}/statistics`
|
||||
`${this.baseUrl}/${tenantId}/forecasts/statistics`
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate multi-day forecasts for a single product
|
||||
* POST /tenants/{tenant_id}/forecasts/multi-day
|
||||
*/
|
||||
async createMultiDayForecast(
|
||||
tenantId: string,
|
||||
request: ForecastRequest
|
||||
): Promise<MultiDayForecastResponse> {
|
||||
return apiClient.post<MultiDayForecastResponse, ForecastRequest>(
|
||||
`${this.baseUrl}/${tenantId}/forecasts/multi-day`,
|
||||
request
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class TrainingService {
|
||||
|
||||
const queryString = params.toString() ? `?${params.toString()}` : '';
|
||||
return apiClient.get<PaginatedResponse<TrainedModelResponse>>(
|
||||
`${this.baseUrl}/${tenantId}/models${queryString}`
|
||||
`${this.baseUrl}/${tenantId}/models/${queryString}`
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -157,4 +157,15 @@ export interface ForecastingHealthResponse {
|
||||
version: string;
|
||||
features: string[];
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export interface MultiDayForecastResponse {
|
||||
tenant_id: string;
|
||||
inventory_product_id: string;
|
||||
forecast_start_date: string; // ISO date string
|
||||
forecast_days: number;
|
||||
forecasts: ForecastResponse[];
|
||||
total_predicted_demand: number;
|
||||
average_confidence_level: number;
|
||||
processing_time_ms: number;
|
||||
}
|
||||
Reference in New Issue
Block a user