Location Service
Component Detail
Service Layer
medium complexity
mobilebackend
1
Dependencies
1
Dependents
2
Entities
0
Integrations
Description
Business logic service handling all geospatial operations for the map feature. Delegates geocoding and reverse geocoding to the backend API to avoid exposing mapping API keys on the client. Calculates distances between mentor coordinates and a reference point for sorting and display, and manages GDPR-compliant consent state for storing location data.
location-service
Responsibilities
- Geocode peer mentor addresses to lat/lng coordinates via backend API
- Calculate distances between mentor and contact locations using Haversine formula
- Sort mentor list by proximity to a reference coordinate
- Enforce GDPR consent check before accessing or storing location data
Interfaces
geocodeAddress(String address) -> Future<LatLng?>
reverseGeocode(LatLng coords) -> Future<String?>
calculateDistance(LatLng from, LatLng to) -> double
sortMentorsByProximity(List<PeerMentor> mentors, LatLng reference) -> List<PeerMentor>
getMentorsInBounds(LatLngBounds bounds) -> Future<List<PeerMentor>>
hasLocationConsent() -> bool
requestLocationConsent() -> Future<bool>
Relationships
Related Data Entities (2)
Data entities managed by this component