Files
maps-saas/apps/api/dist/telemetry/telemetry.controller.js
T

120 lines
5.3 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.TelemetryController = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const telemetry_service_1 = require("./telemetry.service");
const telemetry_analyzer_service_1 = require("./telemetry-analyzer.service");
let TelemetryController = class TelemetryController {
telemetryService;
analyzerService;
constructor(telemetryService, analyzerService) {
this.telemetryService = telemetryService;
this.analyzerService = analyzerService;
}
async ingest(data) {
return this.telemetryService.ingest(data);
}
async sync() {
return this.analyzerService.syncExternalData();
}
async analyze(hours) {
const roadResults = await this.analyzerService.analyzeRoadSpeeds(hours || 24);
const discoveryResults = await this.analyzerService.discoverNewRoads(hours || 168);
return {
success: true,
roadAnalysis: roadResults,
roadDiscovery: discoveryResults,
};
}
async processIntelligence(hours) {
const syncResults = await this.analyzerService.syncExternalData();
const roadResults = await this.analyzerService.analyzeRoadSpeeds(hours || 24);
const discoveryResults = await this.analyzerService.discoverNewRoads(hours || 168);
const summary = await this.analyzerService.getAnalysisSummary();
return {
success: true,
timestamp: new Date(),
sync: syncResults,
analysis: {
roads: roadResults,
discovery: discoveryResults,
},
currentStatus: summary,
};
}
async getSummary() {
return this.analyzerService.getAnalysisSummary();
}
async getNearby(lat, lng, radius) {
return this.telemetryService.getRecentDrivers(Number(lat), Number(lng), Number(radius));
}
};
exports.TelemetryController = TelemetryController;
__decorate([
(0, common_1.Post)(),
(0, swagger_1.ApiOperation)({ summary: 'Ingest driver telemetry 📡' }),
__param(0, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], TelemetryController.prototype, "ingest", null);
__decorate([
(0, common_1.Post)('sync'),
(0, swagger_1.ApiOperation)({ summary: 'Sync data from external server 📡' }),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], TelemetryController.prototype, "sync", null);
__decorate([
(0, common_1.Post)('analyze'),
(0, swagger_1.ApiOperation)({ summary: 'Trigger road and speed analysis 🧠' }),
__param(0, (0, common_1.Query)('hours')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", Promise)
], TelemetryController.prototype, "analyze", null);
__decorate([
(0, common_1.Post)('process-intelligence'),
(0, swagger_1.ApiOperation)({ summary: 'Automated One-Click Sync & Analyze 🚀' }),
__param(0, (0, common_1.Query)('hours')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", Promise)
], TelemetryController.prototype, "processIntelligence", null);
__decorate([
(0, common_1.Get)('summary'),
(0, swagger_1.ApiOperation)({ summary: 'Get analysis summary 📊' }),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], TelemetryController.prototype, "getSummary", null);
__decorate([
(0, common_1.Get)('nearby'),
(0, swagger_1.ApiOperation)({ summary: 'Find nearby drivers 📍' }),
__param(0, (0, common_1.Query)('lat')),
__param(1, (0, common_1.Query)('lng')),
__param(2, (0, common_1.Query)('radius')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number, Number, Number]),
__metadata("design:returntype", Promise)
], TelemetryController.prototype, "getNearby", null);
exports.TelemetryController = TelemetryController = __decorate([
(0, swagger_1.ApiTags)('telemetry'),
(0, common_1.Controller)('telemetry'),
__metadata("design:paramtypes", [telemetry_service_1.TelemetryService,
telemetry_analyzer_service_1.TelemetryAnalyzerService])
], TelemetryController);
//# sourceMappingURL=telemetry.controller.js.map