protect the airport endpoints

This commit is contained in:
Sven Czarnian
2022-11-03 23:32:32 +01:00
parent 572a571acf
commit 0b19c4eab1

View File

@@ -8,6 +8,7 @@ import {
Query, Query,
HttpException, HttpException,
HttpStatus, HttpStatus,
UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { ApiBody, ApiQuery, ApiResponse } from '@nestjs/swagger'; import { ApiBody, ApiQuery, ApiResponse } from '@nestjs/swagger';
import { AirportService } from './airport.service'; import { AirportService } from './airport.service';
@@ -32,6 +33,7 @@ import { ActiveRunwaysDto } from './dto/activerunways.dto';
import { Runway } from './models/runway.model'; import { Runway } from './models/runway.model';
import { RunwayDto } from './dto/runway.dto'; import { RunwayDto } from './dto/runway.dto';
import { AirportOverviewDto } from './dto/airportoverview.dto'; import { AirportOverviewDto } from './dto/airportoverview.dto';
import { JwtGuard } from 'src/auth/guards/jwt.guard';
@Controller('airport') @Controller('airport')
export class AirportController { export class AirportController {
@@ -246,6 +248,7 @@ export class AirportController {
}); });
} }
@UseGuards(JwtGuard)
@Get('/all') @Get('/all')
@ApiResponse({ @ApiResponse({
status: 200, status: 200,
@@ -256,6 +259,7 @@ export class AirportController {
return this.airportService.allAirports(); return this.airportService.allAirports();
} }
@UseGuards(JwtGuard)
@Get('/get') @Get('/get')
@ApiQuery({ @ApiQuery({
name: 'icao', name: 'icao',
@@ -280,6 +284,7 @@ export class AirportController {
}); });
} }
@UseGuards(JwtGuard)
@Post('/register') @Post('/register')
@ApiBody({ @ApiBody({
description: 'The airport definition', description: 'The airport definition',
@@ -317,6 +322,7 @@ export class AirportController {
}); });
} }
@UseGuards(JwtGuard)
@Delete('/remove') @Delete('/remove')
@ApiQuery({ @ApiQuery({
name: 'icao', name: 'icao',
@@ -340,6 +346,7 @@ export class AirportController {
}); });
} }
@UseGuards(JwtGuard)
@Patch('/activateRunways') @Patch('/activateRunways')
@ApiBody({ @ApiBody({
description: 'The airport definition', description: 'The airport definition',