stable: finalized GIS aesthetics and Syria/Jordan routing synchronization

This commit is contained in:
Hamza-Ayed
2026-03-28 04:12:01 +03:00
parent d6f3b41b53
commit 592af8ce5c
203 changed files with 9711 additions and 119 deletions
+11
View File
@@ -0,0 +1,11 @@
export declare class OsmArea {
id: number;
osm_id: number;
longitude: number;
latitude: number;
name: string;
name_ar: string;
place_type: string;
geom: any;
other_tags: string;
}
+65
View File
@@ -0,0 +1,65 @@
"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.OsmArea = void 0;
const typeorm_1 = require("typeorm");
let OsmArea = class OsmArea {
id;
osm_id;
longitude;
latitude;
name;
name_ar;
place_type;
geom;
other_tags;
};
exports.OsmArea = OsmArea;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)(),
__metadata("design:type", Number)
], OsmArea.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'bigint', nullable: true }),
__metadata("design:type", Number)
], OsmArea.prototype, "osm_id", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'decimal', precision: 11, scale: 8, nullable: true }),
__metadata("design:type", Number)
], OsmArea.prototype, "longitude", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 8, nullable: true }),
__metadata("design:type", Number)
], OsmArea.prototype, "latitude", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], OsmArea.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], OsmArea.prototype, "name_ar", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], OsmArea.prototype, "place_type", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'geometry', nullable: true }),
__metadata("design:type", Object)
], OsmArea.prototype, "geom", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], OsmArea.prototype, "other_tags", void 0);
exports.OsmArea = OsmArea = __decorate([
(0, typeorm_1.Entity)('osm_areas')
], OsmArea);
//# sourceMappingURL=osm-area.entity.js.map
@@ -0,0 +1 @@
{"version":3,"file":"osm-area.entity.js","sourceRoot":"","sources":["../../../src/geocoding/entities/osm-area.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAiE;AAG1D,IAAM,OAAO,GAAb,MAAM,OAAO;IAElB,EAAE,CAAS;IAGX,MAAM,CAAS;IAGf,SAAS,CAAS;IAGlB,QAAQ,CAAS;IAGjB,IAAI,CAAS;IAGb,OAAO,CAAS;IAGhB,UAAU,CAAS;IAGnB,IAAI,CAAM;IAGV,UAAU,CAAS;CACpB,CAAA;AA3BY,0BAAO;AAElB;IADC,IAAA,gCAAsB,GAAE;;mCACd;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;uCAC5B;AAGf;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CACnD;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;yCACpD;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qCACd;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACX;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACR;AAGnB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qCACnC;AAGV;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACtB;kBA1BR,OAAO;IADnB,IAAA,gBAAM,EAAC,WAAW,CAAC;GACP,OAAO,CA2BnB"}
@@ -0,0 +1,14 @@
export declare class OsmPointWithArea {
osm_id: number;
longitude: number;
latitude: number;
name: string;
name_ar: string;
amenity: string;
shop: string;
addr_street: string;
neighbourhood_name: string;
city_name: string;
other_tags: string;
geom: any;
}
@@ -0,0 +1,80 @@
"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.OsmPointWithArea = void 0;
const typeorm_1 = require("typeorm");
let OsmPointWithArea = class OsmPointWithArea {
osm_id;
longitude;
latitude;
name;
name_ar;
amenity;
shop;
addr_street;
neighbourhood_name;
city_name;
other_tags;
geom;
};
exports.OsmPointWithArea = OsmPointWithArea;
__decorate([
(0, typeorm_1.PrimaryColumn)({ type: 'bigint' }),
__metadata("design:type", Number)
], OsmPointWithArea.prototype, "osm_id", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'decimal', precision: 11, scale: 8, nullable: true }),
__metadata("design:type", Number)
], OsmPointWithArea.prototype, "longitude", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 8, nullable: true }),
__metadata("design:type", Number)
], OsmPointWithArea.prototype, "latitude", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], OsmPointWithArea.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], OsmPointWithArea.prototype, "name_ar", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], OsmPointWithArea.prototype, "amenity", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], OsmPointWithArea.prototype, "shop", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], OsmPointWithArea.prototype, "addr_street", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], OsmPointWithArea.prototype, "neighbourhood_name", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], OsmPointWithArea.prototype, "city_name", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
__metadata("design:type", String)
], OsmPointWithArea.prototype, "other_tags", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'geometry', spatialFeatureType: 'Point', nullable: true }),
__metadata("design:type", Object)
], OsmPointWithArea.prototype, "geom", void 0);
exports.OsmPointWithArea = OsmPointWithArea = __decorate([
(0, typeorm_1.Entity)('osm_points_with_area')
], OsmPointWithArea);
//# sourceMappingURL=osm-point-with-area.entity.js.map
@@ -0,0 +1 @@
{"version":3,"file":"osm-point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G3B;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACT;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACtB;AAGnB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,kBAAkB,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAChE;2BAnCC,gBAAgB;IAD5B,IAAA,gBAAM,EAAC,sBAAsB,CAAC;GAClB,gBAAgB,CAoC5B"}
@@ -0,0 +1,12 @@
export declare class PlaceSyria {
id: number;
latitude: number;
longitude: number;
name: string;
name_ar: string;
name_en: string;
address: string;
category: string;
created_at: Date;
location: any;
}
+70
View File
@@ -0,0 +1,70 @@
"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.PlaceSyria = void 0;
const typeorm_1 = require("typeorm");
let PlaceSyria = class PlaceSyria {
id;
latitude;
longitude;
name;
name_ar;
name_en;
address;
category;
created_at;
location;
};
exports.PlaceSyria = PlaceSyria;
__decorate([
(0, typeorm_1.PrimaryGeneratedColumn)(),
__metadata("design:type", Number)
], PlaceSyria.prototype, "id", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 8, nullable: true }),
__metadata("design:type", Number)
], PlaceSyria.prototype, "latitude", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'decimal', precision: 11, scale: 8, nullable: true }),
__metadata("design:type", Number)
], PlaceSyria.prototype, "longitude", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], PlaceSyria.prototype, "name", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], PlaceSyria.prototype, "name_ar", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], PlaceSyria.prototype, "name_en", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], PlaceSyria.prototype, "address", void 0);
__decorate([
(0, typeorm_1.Column)({ nullable: true }),
__metadata("design:type", String)
], PlaceSyria.prototype, "category", void 0);
__decorate([
(0, typeorm_1.CreateDateColumn)(),
__metadata("design:type", Date)
], PlaceSyria.prototype, "created_at", void 0);
__decorate([
(0, typeorm_1.Column)({ type: 'geometry', spatialFeatureType: 'Point', nullable: true }),
__metadata("design:type", Object)
], PlaceSyria.prototype, "location", void 0);
exports.PlaceSyria = PlaceSyria = __decorate([
(0, typeorm_1.Entity)('places_syria')
], PlaceSyria);
//# sourceMappingURL=place-syria.entity.js.map
@@ -0,0 +1 @@
{"version":3,"file":"place-syria.entity.js","sourceRoot":"","sources":["../../../src/geocoding/entities/place-syria.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAmF;AAG5E,IAAM,UAAU,GAAhB,MAAM,UAAU;IAErB,EAAE,CAAS;IAGX,QAAQ,CAAS;IAGjB,SAAS,CAAS;IAGlB,IAAI,CAAS;IAGb,OAAO,CAAS;IAGhB,OAAO,CAAS;IAGhB,OAAO,CAAS;IAGhB,QAAQ,CAAS;IAGjB,UAAU,CAAO;IAGjB,QAAQ,CAAM;CACf,CAAA;AA9BY,gCAAU;AAErB;IADC,IAAA,gCAAsB,GAAE;;sCACd;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACpD;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACnD;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;wCACd;AAGb;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACX;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACX;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACX;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACV;AAGjB;IADC,IAAA,0BAAgB,GAAE;8BACP,IAAI;8CAAC;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,kBAAkB,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CAC5D;qBA7BH,UAAU;IADtB,IAAA,gBAAM,EAAC,cAAc,CAAC;GACV,UAAU,CA8BtB"}
+11
View File
@@ -0,0 +1,11 @@
import { GeocodingService } from './geocoding.service';
export declare class GeocodingController {
private readonly geocodingService;
constructor(geocodingService: GeocodingService);
search(query: string): Promise<{
userPlaces: import("./entities/place-syria.entity").PlaceSyria[];
osmAreas: import("./entities/osm-area.entity").OsmArea[];
}>;
reverse(lat: number, lng: number): Promise<any>;
addPlace(placeData: any): Promise<import("./entities/place-syria.entity").PlaceSyria>;
}
+70
View File
@@ -0,0 +1,70 @@
"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.GeocodingController = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const geocoding_service_1 = require("./geocoding.service");
const api_key_guard_1 = require("../common/guards/api-key.guard");
let GeocodingController = class GeocodingController {
geocodingService;
constructor(geocodingService) {
this.geocodingService = geocodingService;
}
async search(query) {
return this.geocodingService.searchPlaces(query);
}
async reverse(lat, lng) {
return this.geocodingService.reverseGeocode(lat, lng);
}
async addPlace(placeData) {
return this.geocodingService.addPlace(placeData);
}
};
exports.GeocodingController = GeocodingController;
__decorate([
(0, common_1.Get)('search'),
(0, swagger_1.ApiOperation)({ summary: 'Search for locations (Forward Geocoding)' }),
(0, swagger_1.ApiQuery)({ name: 'q', required: true }),
__param(0, (0, common_1.Query)('q')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], GeocodingController.prototype, "search", null);
__decorate([
(0, common_1.Get)('reverse'),
(0, swagger_1.ApiOperation)({ summary: 'Reverse Geocoding (Lat/Lng to Address)' }),
(0, swagger_1.ApiQuery)({ name: 'lat', required: true }),
(0, swagger_1.ApiQuery)({ name: 'lng', required: true }),
__param(0, (0, common_1.Query)('lat')),
__param(1, (0, common_1.Query)('lng')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number, Number]),
__metadata("design:returntype", Promise)
], GeocodingController.prototype, "reverse", null);
__decorate([
(0, common_1.Post)('places'),
(0, swagger_1.ApiOperation)({ summary: 'Add a new location (User Submitted)' }),
__param(0, (0, common_1.Body)()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], GeocodingController.prototype, "addPlace", null);
exports.GeocodingController = GeocodingController = __decorate([
(0, swagger_1.ApiTags)('geocoding'),
(0, common_1.Controller)('geocoding'),
(0, common_1.UseGuards)(api_key_guard_1.ApiKeyGuard),
__metadata("design:paramtypes", [geocoding_service_1.GeocodingService])
], GeocodingController);
//# sourceMappingURL=geocoding.controller.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"geocoding.controller.js","sourceRoot":"","sources":["../../src/geocoding/geocoding.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA+E;AAC/E,6CAAkE;AAClE,2DAAuD;AACvD,kEAA6D;AAKtD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IACD;IAA7B,YAA6B,gBAAkC;QAAlC,qBAAgB,GAAhB,gBAAgB,CAAkB;IAAG,CAAC;IAK7D,AAAN,KAAK,CAAC,MAAM,CAAa,KAAa;QACpC,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;IAMK,AAAN,KAAK,CAAC,OAAO,CAAe,GAAW,EAAgB,GAAW;QAChE,OAAO,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACxD,CAAC;IAIK,AAAN,KAAK,CAAC,QAAQ,CAAS,SAAc;QACnC,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC;CACF,CAAA;AAvBY,kDAAmB;AAMxB;IAHL,IAAA,YAAG,EAAC,QAAQ,CAAC;IACb,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,0CAA0C,EAAE,CAAC;IACrE,IAAA,kBAAQ,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC1B,WAAA,IAAA,cAAK,EAAC,GAAG,CAAC,CAAA;;;;iDAEvB;AAMK;IAJL,IAAA,YAAG,EAAC,SAAS,CAAC;IACd,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,wCAAwC,EAAE,CAAC;IACnE,IAAA,kBAAQ,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACzC,IAAA,kBAAQ,EAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3B,WAAA,IAAA,cAAK,EAAC,KAAK,CAAC,CAAA;IAAe,WAAA,IAAA,cAAK,EAAC,KAAK,CAAC,CAAA;;;;kDAErD;AAIK;IAFL,IAAA,aAAI,EAAC,QAAQ,CAAC;IACd,IAAA,sBAAY,EAAC,EAAE,OAAO,EAAE,qCAAqC,EAAE,CAAC;IACjD,WAAA,IAAA,aAAI,GAAE,CAAA;;;;mDAErB;8BAtBU,mBAAmB;IAH/B,IAAA,iBAAO,EAAC,WAAW,CAAC;IACpB,IAAA,mBAAU,EAAC,WAAW,CAAC;IACvB,IAAA,kBAAS,EAAC,2BAAW,CAAC;qCAE0B,oCAAgB;GADpD,mBAAmB,CAuB/B"}
+2
View File
@@ -0,0 +1,2 @@
export declare class GeocodingModule {
}
+33
View File
@@ -0,0 +1,33 @@
"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.GeocodingModule = void 0;
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const geocoding_service_1 = require("./geocoding.service");
const geocoding_controller_1 = require("./geocoding.controller");
const place_syria_entity_1 = require("./entities/place-syria.entity");
const osm_area_entity_1 = require("./entities/osm-area.entity");
const osm_point_with_area_entity_1 = require("./entities/osm-point-with-area.entity");
let GeocodingModule = class GeocodingModule {
};
exports.GeocodingModule = GeocodingModule;
exports.GeocodingModule = GeocodingModule = __decorate([
(0, common_1.Module)({
imports: [
typeorm_1.TypeOrmModule.forFeature([
place_syria_entity_1.PlaceSyria,
osm_area_entity_1.OsmArea,
osm_point_with_area_entity_1.OsmPointWithArea
], 'mysqlConnection'),
],
controllers: [geocoding_controller_1.GeocodingController],
providers: [geocoding_service_1.GeocodingService],
})
], GeocodingModule);
//# sourceMappingURL=geocoding.module.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"geocoding.module.js","sourceRoot":"","sources":["../../src/geocoding/geocoding.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,6CAAgD;AAChD,2DAAuD;AACvD,iEAA6D;AAC7D,sEAA2D;AAC3D,gEAAqD;AACrD,sFAAyE;AAalE,IAAM,eAAe,GAArB,MAAM,eAAe;CAAG,CAAA;AAAlB,0CAAe;0BAAf,eAAe;IAX3B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,uBAAa,CAAC,UAAU,CAAC;gBACvB,+BAAU;gBACV,yBAAO;gBACP,6CAAgB;aACjB,EAAE,iBAAiB,CAAC;SACtB;QACD,WAAW,EAAE,CAAC,0CAAmB,CAAC;QAClC,SAAS,EAAE,CAAC,oCAAgB,CAAC;KAC9B,CAAC;GACW,eAAe,CAAG"}
+17
View File
@@ -0,0 +1,17 @@
import { Repository } from 'typeorm';
import { PlaceSyria } from './entities/place-syria.entity';
import { OsmArea } from './entities/osm-area.entity';
import { OsmPointWithArea } from './entities/osm-point-with-area.entity';
export declare class GeocodingService {
private placesRepository;
private osmAreasRepository;
private osmPointsRepository;
private readonly logger;
constructor(placesRepository: Repository<PlaceSyria>, osmAreasRepository: Repository<OsmArea>, osmPointsRepository: Repository<OsmPointWithArea>);
searchPlaces(query: string): Promise<{
userPlaces: PlaceSyria[];
osmAreas: OsmArea[];
}>;
reverseGeocode(lat: number, lng: number): Promise<any>;
addPlace(data: Partial<PlaceSyria>): Promise<PlaceSyria>;
}
+90
View File
@@ -0,0 +1,90 @@
"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 GeocodingService_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GeocodingService = void 0;
const common_1 = require("@nestjs/common");
const typeorm_1 = require("@nestjs/typeorm");
const typeorm_2 = require("typeorm");
const place_syria_entity_1 = require("./entities/place-syria.entity");
const osm_area_entity_1 = require("./entities/osm-area.entity");
const osm_point_with_area_entity_1 = require("./entities/osm-point-with-area.entity");
let GeocodingService = GeocodingService_1 = class GeocodingService {
placesRepository;
osmAreasRepository;
osmPointsRepository;
logger = new common_1.Logger(GeocodingService_1.name);
constructor(placesRepository, osmAreasRepository, osmPointsRepository) {
this.placesRepository = placesRepository;
this.osmAreasRepository = osmAreasRepository;
this.osmPointsRepository = osmPointsRepository;
}
async searchPlaces(query) {
if (!query || query.length < 3)
return { userPlaces: [], osmAreas: [] };
const userPlaces = await this.placesRepository.find({
where: [
{ name: (0, typeorm_2.Like)(`%${query}%`) },
{ name_ar: (0, typeorm_2.Like)(`%${query}%`) },
],
take: 10,
});
const osmAreas = await this.osmAreasRepository.find({
where: [
{ name: (0, typeorm_2.Like)(`%${query}%`) },
{ name_ar: (0, typeorm_2.Like)(`%${query}%`) },
],
take: 10,
});
return {
userPlaces,
osmAreas,
};
}
async reverseGeocode(lat, lng) {
try {
const query = `
SELECT *, ST_Distance_Sphere(location, POINT(?, ?)) as distance
FROM places_syria
WHERE location IS NOT NULL
ORDER BY distance ASC
LIMIT 5
`;
const results = await this.placesRepository.query(query, [lng, lat]);
return results;
}
catch (error) {
this.logger.error('Reverse geocoding error:', error);
return [];
}
}
async addPlace(data) {
const newPlace = this.placesRepository.create({
...data,
created_at: new Date(),
});
return this.placesRepository.save(newPlace);
}
};
exports.GeocodingService = GeocodingService;
exports.GeocodingService = GeocodingService = GeocodingService_1 = __decorate([
(0, common_1.Injectable)(),
__param(0, (0, typeorm_1.InjectRepository)(place_syria_entity_1.PlaceSyria, 'mysqlConnection')),
__param(1, (0, typeorm_1.InjectRepository)(osm_area_entity_1.OsmArea, 'mysqlConnection')),
__param(2, (0, typeorm_1.InjectRepository)(osm_point_with_area_entity_1.OsmPointWithArea, 'mysqlConnection')),
__metadata("design:paramtypes", [typeorm_2.Repository,
typeorm_2.Repository,
typeorm_2.Repository])
], GeocodingService);
//# sourceMappingURL=geocoding.service.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"geocoding.service.js","sourceRoot":"","sources":["../../src/geocoding/geocoding.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAoD;AACpD,6CAAmD;AACnD,qCAA2C;AAC3C,sEAA2D;AAC3D,gEAAqD;AACrD,sFAAyE;AAGlE,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAKjB;I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