2026-04-13-4
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
import { Controller, Get, Post, Delete, Body, Query, UseGuards, HttpException, HttpStatus } from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiQuery } from '@nestjs/swagger';
|
||||
import { GeocodingService } from './geocoding.service';
|
||||
import { AdminBoundariesService } from './admin-boundaries.service';
|
||||
import { ApiKeyGuard } from '../common/guards/api-key.guard';
|
||||
|
||||
@ApiTags('geocoding')
|
||||
@Controller('geocoding')
|
||||
export class GeocodingController {
|
||||
constructor(private readonly geocodingService: GeocodingService) {}
|
||||
constructor(
|
||||
private readonly geocodingService: GeocodingService,
|
||||
private readonly adminBoundariesService: AdminBoundariesService,
|
||||
) {}
|
||||
|
||||
@Get('search')
|
||||
@ApiOperation({ summary: 'Search for locations (Forward Geocoding)' })
|
||||
@@ -104,4 +108,16 @@ export class GeocodingController {
|
||||
async getGeoJSON() {
|
||||
return this.geocodingService.getAllPlacesGeoJSON();
|
||||
}
|
||||
|
||||
@Post('import-boundaries')
|
||||
@UseGuards(ApiKeyGuard)
|
||||
@ApiOperation({ summary: 'Import administrative boundaries from a local GeoJSON file on the server' })
|
||||
@ApiQuery({ name: 'country', required: true })
|
||||
@ApiQuery({ name: 'filePath', required: true })
|
||||
async importBoundaries(
|
||||
@Query('country') country: string,
|
||||
@Query('filePath') filePath: string,
|
||||
) {
|
||||
return this.adminBoundariesService.importFromFile(country, filePath);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user