Improve the frontend 3
This commit is contained in:
@@ -318,9 +318,11 @@ async def proxy_tenant_customers(request: Request, tenant_id: str = Path(...), p
|
||||
|
||||
@router.api_route("/{tenant_id}/procurement/{path:path}", methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"])
|
||||
async def proxy_tenant_procurement(request: Request, tenant_id: str = Path(...), path: str = ""):
|
||||
"""Proxy tenant procurement requests to orders service"""
|
||||
target_path = f"/api/v1/tenants/{tenant_id}/procurement/{path}".rstrip("/")
|
||||
return await _proxy_to_orders_service(request, target_path, tenant_id=tenant_id)
|
||||
"""Proxy tenant procurement requests to procurement service"""
|
||||
# Remove the /procurement/ part from the path since procurement service doesn't have this prefix
|
||||
# The procurement service expects /api/v1/tenants/{tenant_id}/purchase-orders, not /api/v1/tenants/{tenant_id}/procurement/purchase-orders
|
||||
target_path = f"/api/v1/tenants/{tenant_id}/{path}".rstrip("/")
|
||||
return await _proxy_to_procurement_service(request, target_path, tenant_id=tenant_id)
|
||||
|
||||
# ================================================================
|
||||
# TENANT-SCOPED SUPPLIER SERVICE ENDPOINTS
|
||||
@@ -340,9 +342,9 @@ async def proxy_tenant_suppliers_with_path(request: Request, tenant_id: str = Pa
|
||||
|
||||
@router.api_route("/{tenant_id}/purchase-orders{path:path}", methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"])
|
||||
async def proxy_tenant_purchase_orders(request: Request, tenant_id: str = Path(...), path: str = ""):
|
||||
"""Proxy tenant purchase order requests to suppliers service"""
|
||||
target_path = f"/api/v1/tenants/{tenant_id}/suppliers/purchase-orders{path}".rstrip("/")
|
||||
return await _proxy_to_suppliers_service(request, target_path, tenant_id=tenant_id)
|
||||
"""Proxy tenant purchase order requests to procurement service"""
|
||||
target_path = f"/api/v1/tenants/{tenant_id}/purchase-orders{path}".rstrip("/")
|
||||
return await _proxy_to_procurement_service(request, target_path, tenant_id=tenant_id)
|
||||
|
||||
@router.api_route("/{tenant_id}/deliveries{path:path}", methods=["GET", "POST", "PUT", "DELETE", "OPTIONS"])
|
||||
async def proxy_tenant_deliveries(request: Request, tenant_id: str = Path(...), path: str = ""):
|
||||
@@ -428,6 +430,10 @@ async def _proxy_to_pos_service(request: Request, target_path: str, tenant_id: s
|
||||
"""Proxy request to POS service"""
|
||||
return await _proxy_request(request, target_path, settings.POS_SERVICE_URL, tenant_id=tenant_id)
|
||||
|
||||
async def _proxy_to_procurement_service(request: Request, target_path: str, tenant_id: str = None):
|
||||
"""Proxy request to procurement service"""
|
||||
return await _proxy_request(request, target_path, settings.PROCUREMENT_SERVICE_URL, tenant_id=tenant_id)
|
||||
|
||||
async def _proxy_to_alert_processor_service(request: Request, target_path: str, tenant_id: str = None):
|
||||
"""Proxy request to alert processor service"""
|
||||
return await _proxy_request(request, target_path, settings.ALERT_PROCESSOR_SERVICE_URL, tenant_id=tenant_id)
|
||||
|
||||
Reference in New Issue
Block a user