stable: finalized GIS aesthetics and Syria/Jordan routing synchronization
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
export declare class CandidateRoad {
|
||||
id: string;
|
||||
geometry: any;
|
||||
uniqueDriverCount: number;
|
||||
totalPoints: number;
|
||||
averageSpeed: number;
|
||||
lengthMeters: number;
|
||||
confidence: number;
|
||||
status: string;
|
||||
discoveredAt: Date;
|
||||
reviewedAt: Date;
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
"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);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CandidateRoad = void 0;
|
||||
const typeorm_1 = require("typeorm");
|
||||
let CandidateRoad = class CandidateRoad {
|
||||
id;
|
||||
geometry;
|
||||
uniqueDriverCount;
|
||||
totalPoints;
|
||||
averageSpeed;
|
||||
lengthMeters;
|
||||
confidence;
|
||||
status;
|
||||
discoveredAt;
|
||||
reviewedAt;
|
||||
};
|
||||
exports.CandidateRoad = CandidateRoad;
|
||||
__decorate([
|
||||
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
||||
__metadata("design:type", String)
|
||||
], CandidateRoad.prototype, "id", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)({
|
||||
type: 'geography',
|
||||
spatialFeatureType: 'LineString',
|
||||
srid: 4326,
|
||||
nullable: false,
|
||||
}),
|
||||
(0, typeorm_1.Index)({ spatial: true }),
|
||||
__metadata("design:type", Object)
|
||||
], CandidateRoad.prototype, "geometry", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)('int', { default: 0 }),
|
||||
__metadata("design:type", Number)
|
||||
], CandidateRoad.prototype, "uniqueDriverCount", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)('int', { default: 0 }),
|
||||
__metadata("design:type", Number)
|
||||
], CandidateRoad.prototype, "totalPoints", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)('float', { default: 0 }),
|
||||
__metadata("design:type", Number)
|
||||
], CandidateRoad.prototype, "averageSpeed", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)('float', { default: 0 }),
|
||||
__metadata("design:type", Number)
|
||||
], CandidateRoad.prototype, "lengthMeters", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)('float', { default: 0 }),
|
||||
__metadata("design:type", Number)
|
||||
], CandidateRoad.prototype, "confidence", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)({ default: 'pending' }),
|
||||
__metadata("design:type", String)
|
||||
], CandidateRoad.prototype, "status", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.CreateDateColumn)(),
|
||||
__metadata("design:type", Date)
|
||||
], CandidateRoad.prototype, "discoveredAt", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
|
||||
__metadata("design:type", Date)
|
||||
], CandidateRoad.prototype, "reviewedAt", void 0);
|
||||
exports.CandidateRoad = CandidateRoad = __decorate([
|
||||
(0, typeorm_1.Entity)('candidate_roads')
|
||||
], CandidateRoad);
|
||||
//# sourceMappingURL=candidate-road.entity.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"candidate-road.entity.js","sourceRoot":"","sources":["../../src/maps/candidate-road.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA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AC,iBAAiB,CAAC;GACb,aAAa,CAkDzB"}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import { MapsService } from './maps.service';
|
||||
export declare class MapsController {
|
||||
private readonly mapsService;
|
||||
constructor(mapsService: MapsService);
|
||||
getRoute(fromLat: number, fromLng: number, toLat: number, toLng: number): Promise<{
|
||||
distance: any;
|
||||
duration: number;
|
||||
points: any;
|
||||
bbox: any;
|
||||
congestionAware: boolean;
|
||||
}>;
|
||||
getConfig(): Promise<{
|
||||
center: number[];
|
||||
zoom: number;
|
||||
tileServerUrl: any;
|
||||
}>;
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
"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
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"maps.controller.js","sourceRoot":"","sources":["../../src/maps/maps.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmE;AACnE,6CAAwD;AACxD,iDAA6C;AAC7C,kEAA6D;AAKtD,IAAM,cAAc,GAApB,MAAM,cAAc;IACI;IAA7B,YAA6B,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAInD,AAAN,KAAK,CAAC,QAAQ,CACM,OAAe,EACf,OAAe,EACjB,KAAa,EACb,KAAa;QAE7B,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IACvE,CAAC;IAIK,AAAN,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC;IACzC,CAAC;CACF,CAAA;AAnBY,wCAAc;AAKnB;IAFL,IAAA,YAAG,EAAC,OAAO,CAAC;IACZ,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,yCAAyC,EAAE,CAAC;IAElE,WAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;IAChB,WAAA,IAAA,cAAK,EAAC,SAAS,CAAC,CAAA;IAChB,WAAA,IAAA,cAAK,EAAC,OAAO,CAAC,CAAA;IACd,WAAA,IAAA,cAAK,EAAC,OAAO,CAAC,CAAA;;;;8CAGhB;AAIK;IAFL,IAAA,YAAG,EAAC,QAAQ,CAAC;IACb,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,0CAA0C,EAAE,CAAC;;;;+CAGrE;yBAlBU,cAAc;IAH1B,IAAA,iBAAO,EAAC,MAAM,CAAC;IACf,IAAA,mBAAU,EAAC,MAAM,CAAC;IAClB,IAAA,kBAAS,EAAC,2BAAW,CAAC;qCAEqB,0BAAW;GAD1C,cAAc,CAmB1B"}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
export declare class MapsModule {
|
||||
}
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
"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;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MapsModule = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const typeorm_1 = require("@nestjs/typeorm");
|
||||
const maps_service_1 = require("./maps.service");
|
||||
const maps_controller_1 = require("./maps.controller");
|
||||
const road_stat_entity_1 = require("./road-stat.entity");
|
||||
const candidate_road_entity_1 = require("./candidate-road.entity");
|
||||
const redis_module_1 = require("../common/redis.module");
|
||||
let MapsModule = class MapsModule {
|
||||
};
|
||||
exports.MapsModule = MapsModule;
|
||||
exports.MapsModule = MapsModule = __decorate([
|
||||
(0, common_1.Module)({
|
||||
imports: [
|
||||
typeorm_1.TypeOrmModule.forFeature([road_stat_entity_1.RoadSegmentStat, candidate_road_entity_1.CandidateRoad]),
|
||||
redis_module_1.RedisModule,
|
||||
],
|
||||
controllers: [maps_controller_1.MapsController],
|
||||
providers: [maps_service_1.MapsService],
|
||||
exports: [maps_service_1.MapsService],
|
||||
})
|
||||
], MapsModule);
|
||||
//# sourceMappingURL=maps.module.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"maps.module.js","sourceRoot":"","sources":["../../src/maps/maps.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,iDAA6C;AAC7C,uDAAmD;AACnD,yDAAqD;AACrD,mEAAwD;AACxD,yDAAqD;AAW9C,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,gCAAU;qBAAV,UAAU;IATtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,UAAU,CAAC,CAAC,kCAAe,EAAE,qCAAa,CAAC,CAAC;YAC1D,0BAAW;SACZ;QACD,WAAW,EAAE,CAAC,gCAAc,CAAC;QAC7B,SAAS,EAAE,CAAC,0BAAW,CAAC;QACxB,OAAO,EAAE,CAAC,0BAAW,CAAC;KACvB,CAAC;GACW,UAAU,CAAG"}
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { Repository, DataSource } from 'typeorm';
|
||||
import { RoadSegmentStat } from './road-stat.entity';
|
||||
import { RedisService } from '../common/redis.service';
|
||||
export declare class MapsService {
|
||||
private configService;
|
||||
private roadStatRepo;
|
||||
private dataSource;
|
||||
private redisService;
|
||||
private readonly graphHopperUrl;
|
||||
private readonly TRAFFIC_CACHE_KEY;
|
||||
constructor(configService: ConfigService, roadStatRepo: Repository<RoadSegmentStat>, dataSource: DataSource, redisService: RedisService);
|
||||
getRoute(from: [number, number], to: [number, number]): Promise<{
|
||||
distance: any;
|
||||
duration: number;
|
||||
points: any;
|
||||
bbox: any;
|
||||
congestionAware: boolean;
|
||||
}>;
|
||||
getMapConfig(): Promise<{
|
||||
center: number[];
|
||||
zoom: number;
|
||||
tileServerUrl: any;
|
||||
}>;
|
||||
}
|
||||
Vendored
+134
@@ -0,0 +1,134 @@
|
||||
"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); }
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.MapsService = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const config_1 = require("@nestjs/config");
|
||||
const typeorm_1 = require("@nestjs/typeorm");
|
||||
const typeorm_2 = require("typeorm");
|
||||
const road_stat_entity_1 = require("./road-stat.entity");
|
||||
const redis_service_1 = require("../common/redis.service");
|
||||
const axios_1 = __importDefault(require("axios"));
|
||||
let MapsService = class MapsService {
|
||||
configService;
|
||||
roadStatRepo;
|
||||
dataSource;
|
||||
redisService;
|
||||
graphHopperUrl;
|
||||
TRAFFIC_CACHE_KEY = 'traffic_snapshot';
|
||||
constructor(configService, roadStatRepo, dataSource, redisService) {
|
||||
this.configService = configService;
|
||||
this.roadStatRepo = roadStatRepo;
|
||||
this.dataSource = dataSource;
|
||||
this.redisService = redisService;
|
||||
this.graphHopperUrl = this.configService.get('GRAPH_HOPPER_URL', 'http://map-routing:8080');
|
||||
}
|
||||
async getRoute(from, to) {
|
||||
const congestedSegments = await this.redisService.get(this.TRAFFIC_CACHE_KEY) || [];
|
||||
const buffer = 0.05;
|
||||
const minLat = Math.min(from[0], to[0]) - buffer;
|
||||
const maxLat = Math.max(from[0], to[0]) + buffer;
|
||||
const minLng = Math.min(from[1], to[1]) - buffer;
|
||||
const maxLng = Math.max(from[1], to[1]) + buffer;
|
||||
const nearbyCongestion = congestedSegments.filter(seg => {
|
||||
const geom = JSON.parse(typeof seg.geojson === 'string' ? seg.geojson : JSON.stringify(seg.geojson));
|
||||
return geom.coordinates.some(([lng, lat]) => lat >= minLat && lat <= maxLat && lng >= minLng && lng <= maxLng);
|
||||
}).slice(0, 50);
|
||||
const customModel = {
|
||||
speed: [],
|
||||
areas: {},
|
||||
};
|
||||
nearbyCongestion.forEach((seg, index) => {
|
||||
const areaId = `cong_${index}`;
|
||||
const geojson = typeof seg.geojson === 'string' ? JSON.parse(seg.geojson) : seg.geojson;
|
||||
customModel.areas[areaId] = {
|
||||
type: 'Feature',
|
||||
geometry: geojson,
|
||||
properties: {}
|
||||
};
|
||||
customModel.speed.push({
|
||||
if: `in_${areaId}`,
|
||||
multiply_by: Math.max(0.1, 1 / seg.congestionFactor)
|
||||
});
|
||||
});
|
||||
try {
|
||||
const params = {
|
||||
point: [`${from[0]},${from[1]}`, `${to[0]},${to[1]}`],
|
||||
profile: 'car',
|
||||
locale: 'en',
|
||||
calc_points: true,
|
||||
points_encoded: true,
|
||||
elevation: false,
|
||||
type: 'json',
|
||||
};
|
||||
if (customModel.speed.length > 0) {
|
||||
params.custom_model = JSON.stringify(customModel);
|
||||
}
|
||||
const response = await axios_1.default.get(`${this.graphHopperUrl}/route`, {
|
||||
params,
|
||||
paramsSerializer: (params) => {
|
||||
const searchParams = new URLSearchParams();
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach(v => searchParams.append(key, v));
|
||||
}
|
||||
else {
|
||||
searchParams.append(key, value);
|
||||
}
|
||||
});
|
||||
return searchParams.toString();
|
||||
},
|
||||
});
|
||||
console.log('Routing Successful with congestion:', customModel.speed.length, 'segments');
|
||||
const route = response.data.paths[0];
|
||||
if (!route) {
|
||||
throw new common_1.HttpException('No route found', common_1.HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return {
|
||||
distance: route.distance,
|
||||
duration: route.time / 1000,
|
||||
points: route.points,
|
||||
bbox: route.bbox,
|
||||
congestionAware: customModel.speed.length > 0,
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Routing Error:', error.message);
|
||||
if (error.response) {
|
||||
console.error('GraphHopper Response:', error.response.data);
|
||||
}
|
||||
throw new common_1.HttpException('Error calculating route', common_1.HttpStatus.BAD_GATEWAY);
|
||||
}
|
||||
}
|
||||
async getMapConfig() {
|
||||
return {
|
||||
center: [31.95, 35.91],
|
||||
zoom: 12,
|
||||
tileServerUrl: this.configService.get('TILE_SERVER_URL', 'http://localhost:3001'),
|
||||
};
|
||||
}
|
||||
};
|
||||
exports.MapsService = MapsService;
|
||||
exports.MapsService = MapsService = __decorate([
|
||||
(0, common_1.Injectable)(),
|
||||
__param(1, (0, typeorm_1.InjectRepository)(road_stat_entity_1.RoadSegmentStat)),
|
||||
__metadata("design:paramtypes", [config_1.ConfigService,
|
||||
typeorm_2.Repository,
|
||||
typeorm_2.DataSource,
|
||||
redis_service_1.RedisService])
|
||||
], MapsService);
|
||||
//# sourceMappingURL=maps.service.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"maps.service.js","sourceRoot":"","sources":["../../src/maps/maps.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAuE;AACvE,2CAA+C;AAC/C,6CAAmD;AACnD,qCAAiD;AACjD,yDAAqD;AACrD,2DAAuD;AACvD,kDAA0B;AAGnB,IAAM,WAAW,GAAjB,MAAM,WAAW;IAKZ;IAEA;IACA;IACA;IARO,cAAc,CAAS;IACvB,iBAAiB,GAAG,kBAAkB,CAAC;IAExD,YACU,aAA4B,EAE5B,YAAyC,EACzC,UAAsB,EACtB,YAA0B;QAJ1B,kBAAa,GAAb,aAAa,CAAe;QAE5B,iBAAY,GAAZ,YAAY,CAA6B;QACzC,eAAU,GAAV,UAAU,CAAY;QACtB,iBAAY,GAAZ,YAAY,CAAc;QAElC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,kBAAkB,EAAE,yBAAyB,CAAC,CAAC;IAC9F,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAsB,EAAE,EAAoB;QAGzD,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAQ,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QAI3F,MAAM,MAAM,GAAG,IAAI,CAAC;QACpB,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,C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QAAQ,CAAC,IAAI,CAAC,CAAC;YAC9D,CAAC;YACD,MAAM,IAAI,sBAAa,CAAC,yBAAyB,EAAE,mBAAU,CAAC,WAAW,CAAC,CAAC;QAC7E,CAAC;IACH,CAAC;IAED,KAAK,CAAC,YAAY;QAGhB,OAAO;YACL,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;YACtB,IAAI,EAAE,EAAE;YACR,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;SAClF,CAAC;IACJ,CAAC;CACF,CAAA;AA7HY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;IAOR,WAAA,IAAA,0BAAgB,EAAC,kCAAe,CAAC,CAAA;qCADX,sBAAa;QAEd,oBAAU;QACZ,oBAAU;QACR,4BAAY;GATzB,WAAW,CA6HvB"}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
export declare class RoadSegmentStat {
|
||||
segmentId: string;
|
||||
averageSpeed: number;
|
||||
congestionFactor: number;
|
||||
sampleCount: number;
|
||||
geometry: any;
|
||||
lastUpdated: Date;
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
"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);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RoadSegmentStat = void 0;
|
||||
const typeorm_1 = require("typeorm");
|
||||
let RoadSegmentStat = class RoadSegmentStat {
|
||||
segmentId;
|
||||
averageSpeed;
|
||||
congestionFactor;
|
||||
sampleCount;
|
||||
geometry;
|
||||
lastUpdated;
|
||||
};
|
||||
exports.RoadSegmentStat = RoadSegmentStat;
|
||||
__decorate([
|
||||
(0, typeorm_1.PrimaryColumn)(),
|
||||
__metadata("design:type", String)
|
||||
], RoadSegmentStat.prototype, "segmentId", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)('float', { default: 0 }),
|
||||
__metadata("design:type", Number)
|
||||
], RoadSegmentStat.prototype, "averageSpeed", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)('float', { default: 1.0 }),
|
||||
__metadata("design:type", Number)
|
||||
], RoadSegmentStat.prototype, "congestionFactor", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)('int', { default: 0 }),
|
||||
__metadata("design:type", Number)
|
||||
], RoadSegmentStat.prototype, "sampleCount", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)({
|
||||
type: 'geography',
|
||||
spatialFeatureType: 'LineString',
|
||||
srid: 4326,
|
||||
nullable: true,
|
||||
}),
|
||||
(0, typeorm_1.Index)({ spatial: true }),
|
||||
__metadata("design:type", Object)
|
||||
], RoadSegmentStat.prototype, "geometry", void 0);
|
||||
__decorate([
|
||||
(0, typeorm_1.Column)({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' }),
|
||||
__metadata("design:type", Date)
|
||||
], RoadSegmentStat.prototype, "lastUpdated", void 0);
|
||||
exports.RoadSegmentStat = RoadSegmentStat = __decorate([
|
||||
(0, typeorm_1.Entity)('road_segment_stats')
|
||||
], RoadSegmentStat);
|
||||
//# sourceMappingURL=road-stat.entity.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"road-stat.entity.js","sourceRoot":"","sources":["../../src/maps/road-stat.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAA+D;AAGxD,IAAM,eAAe,GAArB,MAAM,eAAe;IAE1B,SAAS,CAAS;IAGlB,YAAY,CAAS;IAGrB,gBAAgB,CAAS;IAGzB,WAAW,CAAS;IASpB,QAAQ,CAAM;IAGd,WAAW,CAAO;CACnB,CAAA;AAxBY,0CAAe;AAE1B;IADC,IAAA,uBAAa,GAAE;;kDACE;AAGlB;IADC,IAAA,gBAAM,EAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;qDACX;AAGrB;IADC,IAAA,gBAAM,EAAC,OAAO,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;;yDACT;AAGzB;IADC,IAAA,gBAAM,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;oDACV;AASpB;IAPC,IAAA,gBAAM,EAAC;QACN,IAAI,EAAE,WAAW;QACjB,kBAAkB,EAAE,YAAY;QAChC,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACf,CAAC;IACD,IAAA,eAAK,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDACX;AAGd;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAmB,EAAE,CAAC;8BACrD,IAAI;oDAAC;0BAvBP,eAAe;IAD3B,IAAA,gBAAM,EAAC,oBAAoB,CAAC;GAChB,eAAe,CAwB3B"}
|
||||
Reference in New Issue
Block a user