From 17a0249fd204c651c863255c2faa5df606a266f9 Mon Sep 17 00:00:00 2001 From: itskovacs Date: Sun, 9 Nov 2025 19:11:52 +0100 Subject: [PATCH] GMaps autocomplete: image URL --- backend/trip/routers/places.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/trip/routers/places.py b/backend/trip/routers/places.py index 7ca82a2..f01c748 100644 --- a/backend/trip/routers/places.py +++ b/backend/trip/routers/places.py @@ -11,7 +11,7 @@ from ..models.models import (Category, GooglePlaceResult, Image, Place, User) from ..security import verify_exists_and_owns from ..utils.gmaps import (compute_avg_price, compute_description, - gmaps_get_boundaries, gmaps_textsearch) + gmaps_get_boundaries, gmaps_photo, gmaps_textsearch) from ..utils.utils import (b64img_decode, download_file, patch_image, save_image_to_file) @@ -134,6 +134,10 @@ async def google_search_text( allowdog=place.get("allowDogs"), description=compute_description(place), ) + if place.get("photos"): + photo_name = place.get("photos")[0].get("name") + if photo_name: + result.image = await gmaps_photo(photo_name, db_user.google_apikey) results.append(result) return results