partial implementation of search by alias

This commit is contained in:
Guille Gutierrez 2023-12-06 16:19:34 -05:00
parent 146ac487ad
commit e96a4262a7

View File

@ -152,8 +152,14 @@ class CityObject(Repository):
buildings = session.execute(select(Model).where(
Model.city_id.in_(ids), Model.name.in_(names)
))
if len(buildings) == 0:
# search by aliases instead
buildings = session.execute(select(Model).where(
Model.city_id.in_(ids), Model.name.in_(names)
))
results = [r[0] for r in buildings]
print(ids, buildings)
print(ids, [r.name for r in results])
return None
def get_by_name_or_alias_and_city(self, name, city_id) -> Union[Model, None]: