Resolve a property's display address from its landlord_property_id 🟩

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-07-08 09:45:13 +00:00
parent 456d4dffe7
commit 0387f4a897

View file

@ -23,8 +23,15 @@ class LandlordAddressResolver:
def __init__(
self, session: Session, landlord_property_ids: Sequence[str]
) -> None:
self._session = session
self._ids = list(landlord_property_ids)
stmt = select(PropertyRow).where(
col(PropertyRow.landlord_property_id).in_(list(landlord_property_ids))
)
rows = session.execute(stmt).scalars().all() # pyright: ignore[reportDeprecated]
self._by_id: dict[str, str] = {
row.landlord_property_id: row.address
for row in rows
if row.landlord_property_id is not None and row.address is not None
}
def address_for(self, landlord_property_id: str) -> str:
raise NotImplementedError
return self._by_id.get(landlord_property_id, self._FALLBACK)