New alert service

This commit is contained in:
Urtzi Alfaro
2025-12-05 20:07:01 +01:00
parent 1fe3a73549
commit 667e6e0404
393 changed files with 26002 additions and 61033 deletions

View File

@@ -0,0 +1,42 @@
/**
* Service URLs Configuration
*
* Centralizes all backend service URLs for direct service calls.
* Part of Phase 1 architectural refactoring to eliminate orchestrator bottleneck.
*/
const GATEWAY_URL = import.meta.env.VITE_GATEWAY_URL || 'http://localhost:8001';
export const SERVICE_URLS = {
gateway: GATEWAY_URL,
orchestrator: `${GATEWAY_URL}/orchestrator`,
production: `${GATEWAY_URL}/production`,
inventory: `${GATEWAY_URL}/inventory`,
alerts: `${GATEWAY_URL}/alerts`,
sales: `${GATEWAY_URL}/sales`,
procurement: `${GATEWAY_URL}/procurement`,
distribution: `${GATEWAY_URL}/distribution`,
forecasting: `${GATEWAY_URL}/forecasting`,
} as const;
export type ServiceName = keyof typeof SERVICE_URLS;
/**
* Get full URL for a service endpoint
*/
export function getServiceUrl(service: ServiceName, path: string): string {
const baseUrl = SERVICE_URLS[service];
const cleanPath = path.startsWith('/') ? path : `/${path}`;
return `${baseUrl}${cleanPath}`;
}
/**
* Get tenant-specific endpoint URL
*/
export function getTenantEndpoint(
service: ServiceName,
tenantId: string,
endpoint: string
): string {
return getServiceUrl(service, `/api/v1/tenants/${tenantId}/${endpoint}`);
}