Add subcription level filtering

This commit is contained in:
Urtzi Alfaro
2025-09-21 13:27:50 +02:00
parent 29065f5337
commit e1b3184413
21 changed files with 1137 additions and 122 deletions

View File

@@ -82,17 +82,36 @@ class InventoryServiceClient(BaseServiceClient):
params = {}
if is_active is not None:
params["is_active"] = is_active
ingredients = await self.get_paginated("ingredients", tenant_id=tenant_id, params=params)
logger.info("Retrieved all ingredients from inventory service",
logger.info("Retrieved all ingredients from inventory service",
count=len(ingredients), tenant_id=tenant_id)
return ingredients
except Exception as e:
logger.error("Error fetching all ingredients",
logger.error("Error fetching all ingredients",
error=str(e), tenant_id=tenant_id)
return []
async def count_ingredients(self, tenant_id: str, is_active: Optional[bool] = True) -> int:
"""Get count of ingredients for a tenant"""
try:
params = {}
if is_active is not None:
params["is_active"] = is_active
result = await self.get("ingredients/count", tenant_id=tenant_id, params=params)
count = result.get("ingredient_count", 0) if isinstance(result, dict) else 0
logger.info("Retrieved ingredient count from inventory service",
count=count, tenant_id=tenant_id)
return count
except Exception as e:
logger.error("Error fetching ingredient count",
error=str(e), tenant_id=tenant_id)
return 0
async def create_ingredient(self, ingredient_data: Dict[str, Any], tenant_id: str) -> Optional[Dict[str, Any]]:
"""Create a new ingredient"""