mirror of
https://github.com/immich-app/immich.git
synced 2025-12-12 15:50:43 -08:00
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import { Controller, Get, HttpCode, HttpStatus, Query } from '@nestjs/common';
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
import { Endpoint, HistoryBuilder } from 'src/decorators';
|
|
import { AuthDto } from 'src/dtos/auth.dto';
|
|
import {
|
|
MapMarkerDto,
|
|
MapMarkerResponseDto,
|
|
MapReverseGeocodeDto,
|
|
MapReverseGeocodeResponseDto,
|
|
} from 'src/dtos/map.dto';
|
|
import { ApiTag } from 'src/enum';
|
|
import { Auth, Authenticated } from 'src/middleware/auth.guard';
|
|
import { MapService } from 'src/services/map.service';
|
|
|
|
@ApiTags(ApiTag.Map)
|
|
@Controller('map')
|
|
export class MapController {
|
|
constructor(private service: MapService) {}
|
|
|
|
@Get('markers')
|
|
@Authenticated()
|
|
@Endpoint({
|
|
summary: 'Retrieve map markers',
|
|
description: 'Retrieve a list of latitude and longitude coordinates for every asset with location data.',
|
|
history: new HistoryBuilder().added('v1').beta('v1').stable('v2'),
|
|
})
|
|
getMapMarkers(@Auth() auth: AuthDto, @Query() options: MapMarkerDto): Promise<MapMarkerResponseDto[]> {
|
|
return this.service.getMapMarkers(auth, options);
|
|
}
|
|
|
|
@Authenticated()
|
|
@Get('reverse-geocode')
|
|
@HttpCode(HttpStatus.OK)
|
|
@Endpoint({
|
|
summary: 'Reverse geocode coordinates',
|
|
description: 'Retrieve location information (e.g., city, country) for given latitude and longitude coordinates.',
|
|
history: new HistoryBuilder().added('v1').beta('v1').stable('v2'),
|
|
})
|
|
reverseGeocode(@Query() dto: MapReverseGeocodeDto): Promise<MapReverseGeocodeResponseDto[]> {
|
|
return this.service.reverseGeocode(dto);
|
|
}
|
|
}
|