Skip to content
Snippets Groups Projects
Select Git revision
  • 7ed53e756546b424248f004cf7af9da558a1a434
  • dev default protected
  • renovate/ghcr.io-browserless-chromium-2.x
  • 168-pro-connect
  • renovate/major-nest-monorepo
  • renovate/luxon-3.x
  • renovate/gouvfr-anct-timetable-to-osm-opening-hours-2.x
  • renovate/major-typescript-eslint-monorepo
  • renovate/npm-11.x
  • renovate/mysql-9.x
  • renovate/mongo-express-1.x
  • renovate/major-jest-monorepo
  • renovate/tsconfig-paths-4.x
  • renovate/jest-junit-16.x
  • renovate/express-5.x
  • renovate/elastic-elasticsearch-8.x
  • renovate/ghost-5.x
  • renovate/elasticsearch-7.x
  • renovate/devdependencies-(non-major)
  • 722-envsubst-client-side-conf
  • master protected
  • v4.0.3
  • v4.0.1
  • v4.0.0
  • v3.4.3
  • v3.4.2
  • v3.4.1
  • v3.4.0
  • v3.3.1
  • v3.3.0
  • v3.2.0
  • v3.1.0
  • v3.0.1
  • v3.0.0
  • v2.5.0
  • v2.4.2
  • v2.4.1
  • v2.4.0
  • v2.3.2
  • v2.3.1
  • v2.3.0
41 results

structures.controller.spec.ts

Blame
  • tclStopPoint.controller.ts 1.52 KiB
    import { Body, Controller, Logger, Post, UseGuards } from '@nestjs/common';
    import { ApiOperation, ApiResponse, ApiTags } 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 './schemas/pgisCoord.schema';
    import { TclStopPoint } from './tclStopPoint.schema';
    import { TclStopPointService } from './tclStopPoint.service';
    
    @ApiTags('tcl')
    @Controller('tcl')
    export class TclStopPointController {
      private readonly logger = new Logger(TclStopPointController.name);
      constructor(private tclStopPointService: TclStopPointService) {}
    
      @ApiOperation({
        description: `Mettre à jour les points d'arrêt TCL à partir de Data Grand Lyon`,
      })
      @ApiResponse({
        status: 201,
        description: 'The stop points have been updated successfully.',
      })
      @Post('/update')
      @UseGuards(JwtAuthGuard, RolesGuard)
      @Roles('admin')
      public updateStopPoints(): Promise<void> {
        this.logger.debug('updateStopPoints');
        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);
      }
    }