feat: Station matching from receipt (#129) #132
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Relates to #129
Milestone 3: Station Matching from Receipt
Add Google Places API station matching from extracted receipt merchant name.
Files
backend/src/features/fuel-logs/api/fuel-logs.controller.ts(or new endpoint)backend/src/features/stations/external/google-maps/google-maps.client.tsfrontend/src/features/fuel-logs/hooks/useReceiptOcr.tsfrontend/src/features/fuel-logs/components/ReceiptOcrReviewModal.tsxRequirements
Acceptance Criteria
Tests
backend/src/features/stations/tests/unit/station-matching.test.tsMilestone: Station Matching from Receipt (#132)
Phase: Execution | Agent: Developer | Status: PASS
Completed
searchStationByName()togoogle-maps.client.tsusing Places Text Search API. Searches"{merchantName} gas station"withtype: gas_stationfilter. Results cached with 1-hour TTL. Returns null gracefully on API errors/no results.POST /api/stations/matchwithStationMatchBody { merchantName }. Service methodmatchStationFromReceipt()trims input, calls text search, caches matched station for futuresaveStationcalls.useReceiptOcrhook calls/api/stations/matchwith extractedmerchantName(non-blocking).MappedFuelLogFields.locationDatanow includesgooglePlaceIdandaddresswhen station is matched. Review modal shows matched station with place icon and address below the Station field. User can clear the match via close button. Editing merchant name clears any existing match.Files Changed (10)
backend/.../google-maps.client.tssearchStationByName()+transformTextSearchResult()backend/.../google-maps.types.tsGoogleTextSearchResponsetypebackend/.../stations.types.tsStationMatchBody,StationMatchResponsebackend/.../stations.service.tsmatchStationFromReceipt()backend/.../stations.controller.tsmatchStation()handlerbackend/.../stations.routes.tsPOST /stations/matchroutefrontend/.../useReceiptOcr.tsclearMatchedStation(), enriched locationDatafrontend/.../ReceiptOcrReviewModal.tsxfrontend/.../FuelLogForm.tsxmatchedStation/onClearMatchedStationto modalbackend/.../station-matching.test.tsQuality
Verdict: PASS | Next: Quality review