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
+38 -2
View File
@@ -16,6 +16,7 @@ exports.MapRefinementController = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const telemetry_analyzer_service_1 = require("./telemetry-analyzer.service");
const api_key_guard_1 = require("../common/guards/api-key.guard");
let MapRefinementController = class MapRefinementController {
analyzerService;
constructor(analyzerService) {
@@ -38,6 +39,15 @@ let MapRefinementController = class MapRefinementController {
const sinceHours = hours ? Number(hours) : 168;
return this.analyzerService.discoverNewRoads(sinceHours);
}
async getCandidates(status) {
return this.analyzerService.getCandidates(status || 'pending');
}
async discoverClosures(hours) {
return this.analyzerService.discoverRoadClosures(hours || 48);
}
async getClosures() {
return this.analyzerService.getClosures();
}
async getCongestionData(north, south, east, west) {
if (!north || !south || !east || !west) {
throw new common_1.HttpException('Bounds required: north, south, east, west / يجب تحديد الحدود الجغرافية', common_1.HttpStatus.BAD_REQUEST);
@@ -50,10 +60,10 @@ let MapRefinementController = class MapRefinementController {
});
}
async approveCandidate(id) {
return { message: `Candidate ${id} approved`, status: 'approved' };
return this.analyzerService.updateCandidateStatus(id, 'approved');
}
async rejectCandidate(id) {
return { message: `Candidate ${id} rejected`, status: 'rejected' };
return this.analyzerService.updateCandidateStatus(id, 'rejected');
}
};
exports.MapRefinementController = MapRefinementController;
@@ -96,6 +106,31 @@ __decorate([
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", Promise)
], MapRefinementController.prototype, "discoverNewRoads", null);
__decorate([
(0, common_1.Get)('candidates'),
(0, swagger_1.ApiOperation)({ summary: 'Get list of candidate roads / جلب الطرق المرشحة' }),
(0, swagger_1.ApiQuery)({ name: 'status', required: false, enum: ['pending', 'approved', 'rejected'] }),
__param(0, (0, common_1.Query)('status')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], MapRefinementController.prototype, "getCandidates", null);
__decorate([
(0, common_1.Post)('discover-closures'),
(0, swagger_1.ApiOperation)({ summary: 'Run road closure detection 🚧 / تشغيل كشف الإغلاقات' }),
(0, swagger_1.ApiQuery)({ name: 'hours', required: false, description: 'Hours to look back (default: 48)' }),
__param(0, (0, common_1.Query)('hours')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", Promise)
], MapRefinementController.prototype, "discoverClosures", null);
__decorate([
(0, common_1.Get)('closures'),
(0, swagger_1.ApiOperation)({ summary: 'Get currently detected closures / جلب الإغلاقات المكتشفة' }),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], MapRefinementController.prototype, "getClosures", null);
__decorate([
(0, common_1.Get)('congestion'),
(0, swagger_1.ApiOperation)({ summary: 'Get congestion data for heatmap 🗺️ / بيانات الازدحام' }),
@@ -130,6 +165,7 @@ __decorate([
exports.MapRefinementController = MapRefinementController = __decorate([
(0, swagger_1.ApiTags)('map-refinement'),
(0, common_1.Controller)('map-refinement'),
(0, common_1.UseGuards)(api_key_guard_1.ApiKeyGuard),
__metadata("design:paramtypes", [telemetry_analyzer_service_1.TelemetryAnalyzerService])
], MapRefinementController);
//# sourceMappingURL=map-refinement.controller.js.map