fix: improve GPS position sync reliability and add route trails (#21)

Backend:
- Increase sync overlap buffer from 5s to 30s to catch late-arriving positions
- Add position history endpoint GET /gps/locations/:driverId/history
- Add logging for position sync counts (returned vs inserted)

Frontend:
- Add useDriverLocationHistory hook for fetching position trails
- Draw Polyline route trails on GPS map for each tracked driver
- Historical positions shown as semi-transparent paths behind live markers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-08 16:42:41 +01:00
parent 3bc9cd0bca
commit 4dbb899409
4 changed files with 160 additions and 11 deletions

View File

@@ -130,6 +130,21 @@ export class GpsController {
return location;
}
/**
* Get a driver's location history (for route trail display)
*/
@Get('locations/:driverId/history')
@Roles(Role.ADMINISTRATOR)
async getDriverLocationHistory(
@Param('driverId') driverId: string,
@Query('from') fromStr?: string,
@Query('to') toStr?: string,
) {
const from = fromStr ? new Date(fromStr) : undefined;
const to = toStr ? new Date(toStr) : undefined;
return this.gpsService.getDriverLocationHistory(driverId, from, to);
}
/**
* Get a driver's stats (Admin viewing any driver)
*/