introduce the push notification for the airport
This commit is contained in:
		| @@ -8,6 +8,7 @@ import { | |||||||
|   Query, |   Query, | ||||||
|   HttpException, |   HttpException, | ||||||
|   HttpStatus, |   HttpStatus, | ||||||
|  |   Sse, | ||||||
|   UseGuards, |   UseGuards, | ||||||
| } from '@nestjs/common'; | } from '@nestjs/common'; | ||||||
| import { ApiBody, ApiQuery, ApiResponse } from '@nestjs/swagger'; | import { ApiBody, ApiQuery, ApiResponse } from '@nestjs/swagger'; | ||||||
| @@ -33,11 +34,16 @@ 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 { Observable } from 'rxjs'; | ||||||
|  | import { EventsService } from '../events/events.service'; | ||||||
| import { JwtGuard } from 'src/auth/guards/jwt.guard'; | import { JwtGuard } from 'src/auth/guards/jwt.guard'; | ||||||
|  |  | ||||||
| @Controller('airport') | @Controller('airport') | ||||||
| export class AirportController { | export class AirportController { | ||||||
|   constructor(private readonly airportService: AirportService) {} |   constructor( | ||||||
|  |     private readonly airportService: AirportService, | ||||||
|  |     private readonly eventService: EventsService, | ||||||
|  |   ) {} | ||||||
|  |  | ||||||
|   private static convertConstraint<T>( |   private static convertConstraint<T>( | ||||||
|     constraint: Constraint | ConstraintDto, |     constraint: Constraint | ConstraintDto, | ||||||
| @@ -248,6 +254,11 @@ export class AirportController { | |||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   @Sse('/renew') | ||||||
|  |   renew(): Observable<unknown> { | ||||||
|  |     return this.eventService.subscribeAirportRenew(); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   @UseGuards(JwtGuard) |   @UseGuards(JwtGuard) | ||||||
|   @Get('/all') |   @Get('/all') | ||||||
|   @ApiResponse({ |   @ApiResponse({ | ||||||
|   | |||||||
| @@ -3,10 +3,12 @@ import { MongooseModule } from '@nestjs/mongoose'; | |||||||
| import { AirportSchema } from './models/airport.model'; | import { AirportSchema } from './models/airport.model'; | ||||||
| import { AirportService } from './airport.service'; | import { AirportService } from './airport.service'; | ||||||
| import { AirportController } from './airport.controller'; | import { AirportController } from './airport.controller'; | ||||||
|  | import { EventsModule } from 'src/events/events.module'; | ||||||
|  |  | ||||||
| @Module({ | @Module({ | ||||||
|   imports: [ |   imports: [ | ||||||
|     MongooseModule.forFeature([{ name: 'airport', schema: AirportSchema }]), |     MongooseModule.forFeature([{ name: 'airport', schema: AirportSchema }]), | ||||||
|  |     EventsModule, | ||||||
|   ], |   ], | ||||||
|   providers: [AirportService], |   providers: [AirportService], | ||||||
|   controllers: [AirportController], |   controllers: [AirportController], | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user