57 lines
2.7 KiB
JavaScript
57 lines
2.7 KiB
JavaScript
"use strict";
|
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
};
|
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
};
|
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.MapsController = void 0;
|
|
const common_1 = require("@nestjs/common");
|
|
const swagger_1 = require("@nestjs/swagger");
|
|
const maps_service_1 = require("./maps.service");
|
|
const api_key_guard_1 = require("../common/guards/api-key.guard");
|
|
let MapsController = class MapsController {
|
|
mapsService;
|
|
constructor(mapsService) {
|
|
this.mapsService = mapsService;
|
|
}
|
|
async getRoute(fromLat, fromLng, toLat, toLng) {
|
|
return this.mapsService.getRoute([fromLat, fromLng], [toLat, toLng]);
|
|
}
|
|
async getConfig() {
|
|
return this.mapsService.getMapConfig();
|
|
}
|
|
};
|
|
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')),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", [Number, Number, Number, Number]),
|
|
__metadata("design:returntype", Promise)
|
|
], MapsController.prototype, "getRoute", null);
|
|
__decorate([
|
|
(0, common_1.Get)('config'),
|
|
(0, swagger_1.ApiOperation)({ summary: 'Get map configuration for the region 🗺️' }),
|
|
__metadata("design:type", Function),
|
|
__metadata("design:paramtypes", []),
|
|
__metadata("design:returntype", Promise)
|
|
], MapsController.prototype, "getConfig", null);
|
|
exports.MapsController = MapsController = __decorate([
|
|
(0, swagger_1.ApiTags)('maps'),
|
|
(0, common_1.Controller)('maps'),
|
|
(0, common_1.UseGuards)(api_key_guard_1.ApiKeyGuard),
|
|
__metadata("design:paramtypes", [maps_service_1.MapsService])
|
|
], MapsController);
|
|
//# sourceMappingURL=maps.controller.js.map
|