Urtzi Alfaro
ff830a3415
demo seed change
2025-12-13 23:57:54 +01:00
Urtzi Alfaro
667e6e0404
New alert service
2025-12-05 20:07:01 +01:00
Urtzi Alfaro
3242c8d837
Improve te panel de control logic
2025-11-21 16:15:09 +01:00
Claude
413f652bbc
fix: Align dashboard API calls with actual procurement and production service endpoints
...
CRITICAL FIX: Dashboard was calling non-existent API endpoints
The Problem:
------------
The orchestrator dashboard service was calling API endpoints that don't exist:
1. Procurement: Expected dict {items: [...]} but API returns array [...]
2. Production: Called /production/production-batches/today - doesn't exist
3. Production: Called /production/production-batches - doesn't exist
Root Cause:
-----------
Created client methods without verifying actual backend API structure.
Made assumptions about response formats that didn't match reality.
The Fix:
--------
**1. Procurement Client (shared/clients/procurement_client.py)**
- Fixed get_pending_purchase_orders return type: Dict → List
- Procurement API returns: List[PurchaseOrderResponse] directly
- Changed: "Dict with {items: [...], total: n}" → "List of purchase order dicts"
**2. Production Client (shared/clients/production_client.py)**
- Fixed get_todays_batches endpoint:
OLD: "/production/production-batches/today" (doesn't exist)
NEW: "/production/batches?start_date=today&end_date=today"
- Fixed get_production_batches_by_status endpoint:
OLD: "/production/production-batches?status=X"
NEW: "/production/batches?status=X"
- Updated return type docs: {"items": [...]} → {"batches": [...], "total_count": n}
- Response structure: ProductionBatchListResponse (batches, total_count, page, page_size)
**3. Orchestrator Dashboard API (services/orchestrator/app/api/dashboard.py)**
- Fixed all po_data access patterns:
OLD: po_data.get("items", [])
NEW: direct list access or po_data if isinstance(po_data, list)
- Fixed production batch access:
OLD: prod_data.get("items", [])
NEW: prod_data.get("batches", [])
- Updated 6 locations:
* Line 206: health-status pending POs count
* Line 216: health-status production delays count
* Line 274-281: orchestration-summary PO summaries
* Line 328-329: action-queue pending POs
* Line 472-487: insights deliveries calculation
* Line 499-519: insights savings calculation
Verified Against:
-----------------
Frontend successfully calls these exact APIs:
- /tenants/{id}/procurement/purchase-orders (ProcurementPage.tsx)
- /tenants/{id}/production/batches (production hooks)
Both return arrays/objects as documented in their respective API files:
- services/procurement/app/api/purchase_orders.py: returns List[PurchaseOrderResponse]
- services/production/app/api/production_batches.py: returns ProductionBatchListResponse
Now dashboard calls match actual backend APIs! ✅
2025-11-08 06:56:30 +00:00
Claude
6cd4ef0f56
feat: Add dedicated dashboard methods to service clients
...
Created typed, domain-specific methods in service clients instead of
using generic .get() calls with paths. This improves type safety,
discoverability, and maintainability.
Service Client Changes:
- ProcurementServiceClient:
* get_pending_purchase_orders() - POs awaiting approval
* get_critical_alerts() - Critical severity alerts
* get_alerts_summary() - Alert counts by severity
- ProductionServiceClient:
* get_todays_batches() - Today's production timeline
* get_production_batches_by_status() - Filter by status
- InventoryServiceClient:
* get_stock_status() - Dashboard stock metrics
* get_sustainability_widget() - Sustainability data
Dashboard API Changes:
- Updated all endpoints to use new dedicated methods
- Cleaner, more maintainable code
- Better error handling and logging
- Fixed inventory data type handling (list vs dict)
Note: Alert endpoints return 404 - alert_processor service needs
endpoints: /alerts/summary and /alerts (filtered by severity).
2025-11-07 22:12:21 +00:00
Urtzi Alfaro
394ad3aea4
Improve AI logic
2025-11-05 13:34:56 +01:00
Urtzi Alfaro
63f5c6d512
Improve the frontend 3
2025-10-30 21:08:07 +01:00
Urtzi Alfaro
07c33fa578
Improve the frontend and repository layer
2025-10-23 07:44:54 +02:00
Urtzi Alfaro
38fb98bc27
REFACTOR ALL APIs
2025-10-06 15:27:01 +02:00
Urtzi Alfaro
c6dd6fd1de
Add more services
2025-08-21 20:28:14 +02:00