83 lines
2.9 KiB
TypeScript
83 lines
2.9 KiB
TypeScript
import { Repository } from 'typeorm';
|
|
import type { Cache } from 'cache-manager';
|
|
import { PlaceSyria } from './entities/place-syria.entity';
|
|
import { PlaceJordan } from './entities/place-jordan.entity';
|
|
import { PlaceEgypt } from './entities/place-egypt.entity';
|
|
import { PlaceIraq } from './entities/place-iraq.entity';
|
|
import { BasePlace } from './entities/base-place.entity';
|
|
import { OsmArea } from './entities/osm-area.entity';
|
|
import { OsmPointWithArea } from './entities/osm-point-with-area.entity';
|
|
export declare class GeocodingService {
|
|
private placesSyriaRepository;
|
|
private placesJordanRepository;
|
|
private placesEgyptRepository;
|
|
private placesIraqRepository;
|
|
private osmAreasRepository;
|
|
private osmPointsRepository;
|
|
private cacheManager;
|
|
private readonly logger;
|
|
private readonly DB_TIMEOUT_MS;
|
|
constructor(placesSyriaRepository: Repository<PlaceSyria>, placesJordanRepository: Repository<PlaceJordan>, placesEgyptRepository: Repository<PlaceEgypt>, placesIraqRepository: Repository<PlaceIraq>, osmAreasRepository: Repository<OsmArea>, osmPointsRepository: Repository<OsmPointWithArea>, cacheManager: Cache);
|
|
private getRepositoryForCoords;
|
|
private identifyRegion;
|
|
private getTableNameForRepo;
|
|
searchPlaces(query: string, lat?: number, lon?: number, radius?: number, country?: string): Promise<{
|
|
results: any;
|
|
source: string;
|
|
did_you_mean?: undefined;
|
|
} | {
|
|
results: never[];
|
|
did_you_mean: any;
|
|
source?: undefined;
|
|
} | {
|
|
results: any[];
|
|
source?: undefined;
|
|
did_you_mean?: undefined;
|
|
}>;
|
|
private formatResults;
|
|
private getRepoByTableName;
|
|
private logFailedSearch;
|
|
autocomplete(query: string, country?: string): Promise<{
|
|
results: any;
|
|
source: string;
|
|
} | {
|
|
results: any;
|
|
source?: undefined;
|
|
}>;
|
|
private findIraqiAddress;
|
|
reverseGeocode(lat: number, lng: number): Promise<any[]>;
|
|
private extractCoords;
|
|
addPlace(data: Partial<BasePlace>): Promise<any>;
|
|
upsertPlace(data: Partial<BasePlace>): Promise<{
|
|
id: any;
|
|
action: string;
|
|
}>;
|
|
upsertBatch(places: Partial<BasePlace>[]): Promise<{
|
|
total: number;
|
|
processed: number;
|
|
created: number;
|
|
updated: number;
|
|
failed: number;
|
|
errors: {
|
|
index: number;
|
|
name?: string;
|
|
reason: string;
|
|
}[];
|
|
errorsTruncated: boolean;
|
|
}>;
|
|
getRecentPlaces(limit?: number): Promise<any[]>;
|
|
getAllPlacesGeoJSON(): Promise<{
|
|
type: string;
|
|
features: any;
|
|
}>;
|
|
deletePlacesByName(name: string, country: string): Promise<{
|
|
success: boolean;
|
|
affected: any;
|
|
}>;
|
|
deletePlaceById(id: number, country: string): Promise<{
|
|
success: boolean;
|
|
affected: any;
|
|
}>;
|
|
private getRepoByCountry;
|
|
}
|