mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-21 17:01:14 +00:00
b0fffa6d42
Phase A baseline outputs from /autodev (Steps 1-5): - Problem & solution docs (_docs/00_problem, _docs/01_solution) - Codebase documentation (_docs/02_document) incl. architecture, module-layout, glossary, system-flows, baseline compliance scan - Test specs (blackbox, performance, resilience, security, resource, traceability matrix) - Test task decomposition (_docs/02_tasks/todo): AZ-285..AZ-290 - Testability refactor (_docs/04_refactoring/01-testability-refactoring): - TC-01 Move DownloadedTileInfoV2 + new ExistingTileInfo to Common.DTO - TC-02 Replace dead ISatelliteDownloader API with real signatures - TC-03 GoogleMapsDownloaderV2 implements ISatelliteDownloader - TC-04 TileService depends on ISatelliteDownloader (mockable) - TC-05 DI + endpoints use ISatelliteDownloader - Test runner scripts (scripts/run-tests.sh, run-performance-tests.sh) - Autodev state pointer (_docs/_autodev_state.md) Prepares the codebase for AZ-285..AZ-290 unit/integration test work. Co-authored-by: Cursor <cursoragent@cursor.com>
2.3 KiB
2.3 KiB
Module: DataAccess/Repositories/RouteRepository
Purpose
Dapper-based repository for the routes, route_points, and route_regions tables. Handles route persistence, point storage, and route-region linking (including geofence metadata).
Public Interface
IRouteRepository (interface)
GetByIdAsync(Guid id) → Task<RouteEntity?>GetRoutePointsAsync(Guid routeId) → Task<IEnumerable<RoutePointEntity>>: ordered bysequence_numberInsertRouteAsync(RouteEntity route) → Task<Guid>InsertRoutePointsAsync(IEnumerable<RoutePointEntity> points) → Task: bulk insertUpdateRouteAsync(RouteEntity route) → Task<int>DeleteRouteAsync(Guid id) → Task<int>LinkRouteToRegionAsync(Guid routeId, Guid regionId, bool isGeofence, int? geofencePolygonIndex) → Task: inserts intoroute_regionswithON CONFLICT DO NOTHINGGetRegionIdsByRouteAsync(Guid routeId) → Task<IEnumerable<Guid>>: non-geofence region IDsGetGeofenceRegionIdsByRouteAsync(Guid routeId) → Task<IEnumerable<Guid>>: geofence-only region IDsGetGeofenceRegionsByPolygonAsync(Guid routeId) → Task<Dictionary<int, List<Guid>>>: groups geofence regions by polygon indexGetRoutesWithPendingMapsAsync() → Task<IEnumerable<RouteEntity>>: routes whererequest_maps = true AND maps_ready = false
RouteRepository (implementation)
Same connection-per-call pattern. InsertRoutePointsAsync uses Dapper's bulk execute to insert all points in a single round-trip.
Internal Logic
LinkRouteToRegionAsyncusesON CONFLICT DO NOTHINGto handle duplicate links gracefullyGetGeofenceRegionsByPolygonAsyncgroups results into a dictionary keyed bygeofence_polygon_indexGetRoutesWithPendingMapsAsyncdrives theRouteProcessingServicepolling loop
Dependencies
- NuGet:
Dapper,Npgsql SatelliteProvider.DataAccess.Models.RouteEntity,RoutePointEntityMicrosoft.Extensions.Logging
Consumers
RouteService— insert route, points, link regionsRouteProcessingService— read route state, points, region links; update route after map generation
Data Models
Operates on RouteEntity, RoutePointEntity, and the route_regions junction table.
Configuration
Connection string via constructor.
External Integrations
PostgreSQL.
Security
None.
Tests
No dedicated tests.