Browse Source

protect the airport endpoints

Sven Czarnian 2 years ago
parent
commit
0b19c4eab1
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/airport/airport.controller.ts

+ 7 - 0
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',