mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-16 23:40:32 +00:00
implement method to get polyline data
This commit is contained in:
@@ -248,6 +248,22 @@ export class RepositoryDataLoader {
|
||||
}
|
||||
|
||||
private async updatePolylineDataForExistingRoutesAndApiResponse(json: any) {
|
||||
if (json.routePoints) {
|
||||
await Promise.all(Object.keys(json.routePoints).map(async (routeId) => {
|
||||
const routePoints = json.routePoints[routeId][0];
|
||||
|
||||
const existingRoute = await this.repository.getRouteById(routeId);
|
||||
if (!existingRoute) return;
|
||||
|
||||
existingRoute.polylineCoordinates = routePoints.map((point: any) => {
|
||||
return {
|
||||
latitude: parseFloat(point.lat),
|
||||
longitude: parseFloat(point.lng),
|
||||
};
|
||||
});
|
||||
|
||||
await this.repository.addOrUpdateRoute(existingRoute);
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user