New alert service

This commit is contained in:
Urtzi Alfaro
2025-12-05 20:07:01 +01:00
parent 1fe3a73549
commit 667e6e0404
393 changed files with 26002 additions and 61033 deletions

View File

@@ -84,6 +84,20 @@ class SupplierRepository(BaseRepository[Supplier]):
).order_by(self.model.name)
result = await self.db.execute(stmt)
return result.scalars().all()
async def get_suppliers_by_ids(self, tenant_id: UUID, supplier_ids: List[UUID]) -> List[Supplier]:
"""Get multiple suppliers by IDs in a single query (batch fetch)"""
if not supplier_ids:
return []
stmt = select(self.model).filter(
and_(
self.model.tenant_id == tenant_id,
self.model.id.in_(supplier_ids)
)
).order_by(self.model.name)
result = await self.db.execute(stmt)
return result.scalars().all()
def get_suppliers_by_type(
self,