From 0b19c4eab17772de315a115f2fd6a23332a65f4e Mon Sep 17 00:00:00 2001 From: Sven Czarnian Date: Thu, 3 Nov 2022 23:32:32 +0100 Subject: [PATCH] protect the airport endpoints --- src/airport/airport.controller.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/airport/airport.controller.ts b/src/airport/airport.controller.ts index 761bbf8..b058394 100644 --- a/src/airport/airport.controller.ts +++ b/src/airport/airport.controller.ts @@ -8,6 +8,7 @@ import { Query, HttpException, HttpStatus, + UseGuards, } from '@nestjs/common'; import { ApiBody, ApiQuery, ApiResponse } from '@nestjs/swagger'; import { AirportService } from './airport.service'; @@ -32,6 +33,7 @@ import { ActiveRunwaysDto } from './dto/activerunways.dto'; import { Runway } from './models/runway.model'; import { RunwayDto } from './dto/runway.dto'; import { AirportOverviewDto } from './dto/airportoverview.dto'; +import { JwtGuard } from 'src/auth/guards/jwt.guard'; @Controller('airport') export class AirportController { @@ -246,6 +248,7 @@ export class AirportController { }); } + @UseGuards(JwtGuard) @Get('/all') @ApiResponse({ status: 200, @@ -256,6 +259,7 @@ export class AirportController { return this.airportService.allAirports(); } + @UseGuards(JwtGuard) @Get('/get') @ApiQuery({ name: 'icao', @@ -280,6 +284,7 @@ export class AirportController { }); } + @UseGuards(JwtGuard) @Post('/register') @ApiBody({ description: 'The airport definition', @@ -317,6 +322,7 @@ export class AirportController { }); } + @UseGuards(JwtGuard) @Delete('/remove') @ApiQuery({ name: 'icao', @@ -340,6 +346,7 @@ export class AirportController { }); } + @UseGuards(JwtGuard) @Patch('/activateRunways') @ApiBody({ description: 'The airport definition',