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

@@ -80,3 +80,40 @@ class POSConfigurationRepository(BaseRepository[POSConfiguration, dict, dict]):
except Exception as e:
logger.error("Failed to count configurations by tenant", error=str(e), tenant_id=tenant_id)
raise
async def get_by_pos_identifier(
self,
pos_system: str,
identifier: str
) -> Optional[POSConfiguration]:
"""
Get POS configuration by POS-specific identifier
Args:
pos_system: POS system name (square, toast, lightspeed)
identifier: merchant_id, location_id, or other POS-specific ID
Returns:
POSConfiguration if found, None otherwise
"""
try:
query = select(self.model).where(
and_(
self.model.pos_system == pos_system,
or_(
self.model.merchant_id == identifier,
self.model.location_id == identifier
),
self.model.is_active == True
)
).order_by(self.model.created_at.desc())
result = await self.session.execute(query)
return result.scalars().first()
except Exception as e:
logger.error("Failed to get config by POS identifier",
error=str(e),
pos_system=pos_system,
identifier=identifier)
raise