Improve the frontend and repository layer
This commit is contained in:
@@ -251,10 +251,33 @@ class RecipesServiceClient(BaseServiceClient):
|
||||
error=str(e), tenant_id=tenant_id)
|
||||
return []
|
||||
|
||||
# ================================================================
|
||||
# COUNT AND STATISTICS
|
||||
# ================================================================
|
||||
|
||||
async def count_recipes(self, tenant_id: str) -> int:
|
||||
"""
|
||||
Get the count of recipes for a tenant
|
||||
Used for subscription limit tracking
|
||||
|
||||
Returns:
|
||||
int: Number of recipes for the tenant
|
||||
"""
|
||||
try:
|
||||
result = await self.get("recipes/count", tenant_id=tenant_id)
|
||||
count = result.get('count', 0) if result else 0
|
||||
logger.info("Retrieved recipe count from recipes service",
|
||||
count=count, tenant_id=tenant_id)
|
||||
return count
|
||||
except Exception as e:
|
||||
logger.error("Error getting recipe count",
|
||||
error=str(e), tenant_id=tenant_id)
|
||||
return 0
|
||||
|
||||
# ================================================================
|
||||
# UTILITY METHODS
|
||||
# ================================================================
|
||||
|
||||
|
||||
async def health_check(self) -> bool:
|
||||
"""Check if recipes service is healthy"""
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user