2026-04-14-8 auth and commercial

This commit is contained in:
Hamza-Ayed
2026-04-14 20:14:48 +03:00
parent be7dcc2652
commit f5b3f9f790
430 changed files with 6074 additions and 751 deletions
+27 -8
View File
@@ -22,8 +22,30 @@ let MapsController = class MapsController {
constructor(mapsService) {
this.mapsService = mapsService;
}
async getRoute(fromLat, fromLng, toLat, toLng) {
return this.mapsService.getRoute([fromLat, fromLng], [toLat, toLng]);
async getRoute(query) {
const waypoints = [];
if (query.fromLat && query.fromLng) {
waypoints.push([parseFloat(query.fromLat), parseFloat(query.fromLng)]);
}
const stopKeys = Object.keys(query)
.filter(key => key.startsWith('stop') && key.endsWith('Lat'))
.sort((a, b) => {
const numA = parseInt(a.replace('stop', '').replace('Lat', ''), 10);
const numB = parseInt(b.replace('stop', '').replace('Lat', ''), 10);
return numA - numB;
});
for (const latKey of stopKeys) {
const prefix = latKey.replace('Lat', '');
const lngKey = `${prefix}Lng`;
if (query[latKey] && query[lngKey]) {
waypoints.push([parseFloat(query[latKey]), parseFloat(query[lngKey])]);
}
}
if (query.toLat && query.toLng) {
waypoints.push([parseFloat(query.toLat), parseFloat(query.toLng)]);
}
const profile = query.profile || 'car';
return this.mapsService.getRoute(waypoints, profile);
}
async getConfig() {
return this.mapsService.getMapConfig();
@@ -32,13 +54,10 @@ let MapsController = class MapsController {
exports.MapsController = MapsController;
__decorate([
(0, common_1.Get)('route'),
(0, swagger_1.ApiOperation)({ summary: 'Calculate a route between two points 🚗' }),
__param(0, (0, common_1.Query)('fromLat')),
__param(1, (0, common_1.Query)('fromLng')),
__param(2, (0, common_1.Query)('toLat')),
__param(3, (0, common_1.Query)('toLng')),
(0, swagger_1.ApiOperation)({ summary: 'Calculate a route with dynamic waypoints 🚗' }),
__param(0, (0, common_1.Query)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number, Number, Number, Number]),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], MapsController.prototype, "getRoute", null);
__decorate([