Add POI feature and imporve the overall backend implementation

This commit is contained in:
Urtzi Alfaro
2025-11-12 15:34:10 +01:00
parent e8096cd979
commit 5783c7ed05
173 changed files with 16862 additions and 9078 deletions

View File

@@ -98,6 +98,28 @@ class StockRepository(BaseRepository[Stock, StockCreate, StockUpdate], BatchCoun
logger.error("Failed to get stock by ingredient", error=str(e), ingredient_id=ingredient_id)
raise
async def get_stock_by_product(
self,
tenant_id: UUID,
inventory_product_id: UUID,
include_unavailable: bool = False
) -> List[Stock]:
"""
Get all stock entries for a specific product.
Note: inventory_product_id and ingredient_id refer to the same entity.
The 'ingredients' table is used as a unified catalog for both raw ingredients
and finished products, distinguished by the product_type field.
This method is an alias for get_stock_by_ingredient for clarity when called
from contexts that use 'product' terminology (e.g., procurement service).
"""
return await self.get_stock_by_ingredient(
tenant_id=tenant_id,
ingredient_id=inventory_product_id,
include_unavailable=include_unavailable
)
async def get_total_stock_by_ingredient(self, tenant_id: UUID, ingredient_id: UUID) -> Dict[str, float]:
"""Get total stock quantities for an ingredient"""
try: