feat: implement manual routing sync system, update map tile URLs to HTTPS, and migrate admin session storage to localStorage

This commit is contained in:
Hamza-Ayed
2026-07-15 23:01:18 +03:00
parent 78fe6c48cc
commit c97c961c96
14 changed files with 281 additions and 18 deletions
+7 -1
View File
@@ -1,4 +1,4 @@
import { Controller, Get, Query, UseGuards, Res } from '@nestjs/common';
import { Controller, Get, Post, Query, UseGuards, Res } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import type { Response } from 'express';
import * as fs from 'fs';
@@ -12,6 +12,12 @@ import { ApiKeyGuard } from '../common/guards/api-key.guard';
export class MapsController {
constructor(private readonly mapsService: MapsService) { }
@Post('sync-routes')
@ApiOperation({ summary: 'Request GraphHopper routing sync 🔄' })
async syncRoutes() {
return this.mapsService.requestRoutingSync();
}
@Get('style.json')
@ApiOperation({ summary: 'Get MapLibre style JSON 🎨' })
async getStyleJson(@Query('theme') theme: string, @Res() res: Response) {
+7
View File
@@ -7,6 +7,7 @@ import axios from 'axios';
import { RoadSegmentStat } from './road-stat.entity';
import { TrafficGridService } from './traffic-grid.service';
import { GeocodingService } from '../geocoding/geocoding.service';
import { RedisService } from '../common/redis.service';
@Injectable()
export class MapsService {
@@ -19,10 +20,16 @@ export class MapsService {
private trafficGrid: TrafficGridService,
private geocodingService: GeocodingService,
private dataSource: DataSource,
private redisService: RedisService,
) {
this.graphHopperUrl = this.configService.get('GRAPH_HOPPER_URL', 'http://routing:8080');
}
async requestRoutingSync() {
await this.redisService.set('routing_sync_requested', '1');
return { success: true, message: 'Routing sync requested and scheduled for the next minute.' };
}
async getRoute(waypoints: [number, number][], profile: string = 'car', steps: boolean = false, locale: string = 'en', alternatives: boolean = false) {
if (waypoints.length < 2) {