Merged
Conversation
…ePoject initialize springboot project
…ePoject initialize a dummy pipeline
…kila initial commit for social media service
Dev apigateway
Dev apigateway
api service initial implementation
Modifies the API service to construct full image URLs for places,
rather than requiring the frontend to do so. This enhances API key
security by keeping the Google Maps API key on the backend.
Changes:
- Updated `api-service/models/places_model.go` to add a `PhotoURLs` field (type `[]string`) to the place result struct. This field will store the fully constructed photo URLs.
- Modified `api-service/services/maps/places_service.go`:
- `TextSearch` and `NearbySearch` functions now unmarshal the Google API response into `models.PlacesResponse`.
- These functions iterate over the photo references from the Google API, construct the full photo URL (including the API key), and populate the new `PhotoURLs` field.
- Return types were changed to `*models.PlacesResponse`.
- `api-service/controllers/maps_controller.go` was confirmed to correctly handle the updated service response type due to Gin's flexible JSON marshalling.
Frontend Impact:
You should update the frontend to:
- Expect a `photo_urls: string[]` field in the location details.
- Use these URLs directly to display images.
- The existing `photos` array (with `photo_reference`) in frontend types may be redundant.
Implements a new API endpoint `/maps/place/:place_id` to fetch detailed
information for a specific place using its Google Place ID.
Changes:
- **Models (`api-service/models/places_model.go`):**
- Defined a reusable top-level `Geometry` struct.
- Added new structs for Place Details: `PlacePhoto`, `PlaceReview`,
`OpeningHoursPeriodDetail`, `OpeningHoursPeriod`, `PlaceOpeningHours`,
`PlaceDetailResult`, and `PlaceDetailResponse`.
- `PlaceDetailResult` includes a `PhotoURLs []string` field for fully
constructed image URLs, similar to the places search.
- **Service (`api-service/services/maps/places_service.go`):**
- Modified `FindPlaceByID` to:
- Return `*models.PlaceDetailResponse`.
- Unmarshal the Google Places Details API response into the new structs.
- Populate `PhotoURLs` from photo references.
- Include a `fields` parameter in the Google API request to fetch
a comprehensive set of details.
- Improved error handling to return the parsed Google response
even on API errors.
- **Controller (`api-service/controllers/maps_controller.go`):**
- Added `PlaceDetailsController` to handle requests.
- Extracts `place_id` from the URL path.
- Calls `placesService.FindPlaceByID`.
- Maps Google API statuses (OK, NOT_FOUND, INVALID_REQUEST, etc.)
from the service response to appropriate HTTP status codes.
- **Routes (`api-service/routes/routes.go`):**
- Added a new route `GET /maps/place/:place_id` linked to
`PlaceDetailsController`.
- **Documentation (`api-service/api.md`):**
- Added a new section documenting the `/maps/place/:place_id` endpoint,
including its path, method, parameters, example request,
and detailed response structure (with `PhotoURLs` and error codes).
This new endpoint allows the frontend to fetch rich details for a specific
place, enhancing your experience on place detail pages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.