Improve the frontend and repository layer
This commit is contained in:
@@ -381,24 +381,47 @@ class SuppliersServiceClient(BaseServiceClient):
|
||||
# ================================================================
|
||||
# ALERTS AND NOTIFICATIONS
|
||||
# ================================================================
|
||||
|
||||
|
||||
async def acknowledge_alert(self, tenant_id: str, alert_id: str) -> Optional[Dict[str, Any]]:
|
||||
"""Acknowledge a supplier-related alert"""
|
||||
try:
|
||||
result = await self.post(f"suppliers/alerts/{alert_id}/acknowledge", data={}, tenant_id=tenant_id)
|
||||
if result:
|
||||
logger.info("Acknowledged supplier alert",
|
||||
logger.info("Acknowledged supplier alert",
|
||||
alert_id=alert_id, tenant_id=tenant_id)
|
||||
return result
|
||||
except Exception as e:
|
||||
logger.error("Error acknowledging supplier alert",
|
||||
logger.error("Error acknowledging supplier alert",
|
||||
error=str(e), alert_id=alert_id, tenant_id=tenant_id)
|
||||
return None
|
||||
|
||||
|
||||
# ================================================================
|
||||
# COUNT AND STATISTICS
|
||||
# ================================================================
|
||||
|
||||
async def count_suppliers(self, tenant_id: str) -> int:
|
||||
"""
|
||||
Get the count of suppliers for a tenant
|
||||
Used for subscription limit tracking
|
||||
|
||||
Returns:
|
||||
int: Number of suppliers for the tenant
|
||||
"""
|
||||
try:
|
||||
result = await self.get("suppliers/count", tenant_id=tenant_id)
|
||||
count = result.get('count', 0) if result else 0
|
||||
logger.info("Retrieved supplier count from suppliers service",
|
||||
count=count, tenant_id=tenant_id)
|
||||
return count
|
||||
except Exception as e:
|
||||
logger.error("Error getting supplier count",
|
||||
error=str(e), tenant_id=tenant_id)
|
||||
return 0
|
||||
|
||||
# ================================================================
|
||||
# UTILITY METHODS
|
||||
# ================================================================
|
||||
|
||||
|
||||
async def health_check(self) -> bool:
|
||||
"""Check if suppliers service is healthy"""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user