| 1 | import { Controller, Get, Query } from '@nestjs/common'; |
| 2 | import { |
| 3 | ApiBearerAuth, |
| 4 | ApiOkResponse, |
| 5 | ApiOperation, |
| 6 | ApiQuery, |
| 7 | ApiTags, |
| 8 | } from '@nestjs/swagger'; |
| 9 | |
| 10 | import { AirportsService } |
| 11 | import { AirportEntity } |
| 12 | |
| 13 | @Controller('airports') |
| 14 | @ApiTags('Airports') |
| 15 | @ApiBearerAuth() |
| 16 | export class AirportsController |
| 17 | constructor(private readonly |
| 18 | |
| 19 | @Get() |
| 20 | @ApiOperation({ |
| 21 | description: |
| 22 | 'Get all airports. We do not recommend using this route without any search query. This route has over 20k records', |
| 23 | summary: 'Get all airports', |
| 24 | }) |
| 25 | @ApiOkResponse({ |
| 26 | type: [AirportEntity], |
| 27 | }) |
| 28 | @ApiQuery({ |
| 29 | name: 'search', |
| 30 | required: false, |
| 31 | type: String, |
| 32 | example: 'VIDP', |
| 33 | description: |
| 34 | 'Search query for airport. Can be iata, ident(icao), name or a part of any these. Searching is case insensitive', |
| 35 | }) |
| 36 | getAirports(@Query( |
| 37 | return this.airportsService |
| 38 | } |
| 39 | } |