New alert service
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user