MentorLocationRepository
Component Detail
Description
Provides read access to mentor geographic coordinates and location metadata stored in the database. Abstracts spatial queries so the matching service receives clean coordinate tuples without raw SQL. Supports bounding-box pre-filtering to reduce candidate set before distance computation.
mentor-location-repository
Sources & reasoning
Line 99 directly ties geographic visualization to matching and assignment dispatch (oppdragstildeling), providing the provenance for this feature as a distinct matching capability beyond simple map display. Line 358 places it in Fase 3, normalizing to v1.1. The blueprint lists this feature under Geographic Map View at [v1.1]. Kept as a separate feature from peer-mentor-map because matching logic and the dispatch integration are distinct from rendering the map layer.
-
docs/source/likeperson.md · line 99Geografisk kartvisning av likepersoner for matching og oppdragstildeling (særlig store fylker).
-
docs/source/likeperson.md · line 358Geografisk kartvisning (Blindeforbundet)
Responsibilities
- Retrieve mentor coordinates with optional bounding-box pre-filter
- Return last-known location timestamp alongside coordinates
- Cache frequently queried regions in memory with TTL
- Map raw database rows to typed MentorLocation domain objects
- Expose count queries for availability reporting
Interfaces
findByRegion(bounds: GeoBoundingBox): Promise<MentorLocation[]>
findById(mentorId: string): Promise<MentorLocation | null>
findAvailableWithinRadius(center: Coordinates, radiusKm: number): Promise<MentorLocation[]>
invalidateRegionCache(region: string): void
Related Data Entities (2)
Data entities managed by this component