Newer
Older
import { Body, Controller, Get, Post, UseGuards } from '@nestjs/common';
import { ApiOperation, ApiResponse } from '@nestjs/swagger';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { Roles } from '../users/decorators/roles.decorator';
import { RolesGuard } from '../users/guards/roles.guard';
import { PgisCoord } from './interfaces/pgis.coord';
import { TclStopPoint } from './tclStopPoint.schema';
import { TclStopPointService } from './tclStopPoint.service';
@Controller('tcl')
export class TclStopPointController {
constructor(private tclStopPointService: TclStopPointService) {}
@ApiOperation({
description: `Mettre à jour les points d'arrêt TCL à partir de Data Grand Lyon`,
})
@ApiResponse({
status: 204,
description: 'The stop points have been updated successfully.',
})
@Get('/update')
public updateStopPoints(): Promise<void> {
return this.tclStopPointService.updateStopPoints();
}
@ApiOperation({
description: `Récupérer les arrêts les plus proches d'un point géographique`,
})
@ApiResponse({
status: 200,
description: 'The closest stop points have been fetched successfully.',
})
@Post('/closest')
public getClosestStopPoints(@Body() pgisCoord: PgisCoord): Promise<TclStopPoint[]> {
return this.tclStopPointService.getClosestStopPoints(pgisCoord);
}
}