-
Notifications
You must be signed in to change notification settings - Fork 1
/
controllers.ts
37 lines (29 loc) · 948 Bytes
/
controllers.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Controller, Get} from '@nestjs/common';
import { AirportsService, PositionsService } from './services'
import { FeatureCollection } from 'geojson';
@Controller('positions')
export class PositionsController {
constructor(private readonly service: PositionsService) {}
@Get('count/all')
getAll(){
return this.service.getTotalCount();
}
@Get('last/feature')
getLastPosition(){
return this.service.getLastPosition();
}
@Get('last/geojson')
async getLastPositionsAsGeoJSON(){
const positions = await this.service.getAllLastPositions();
console.log('Last positions: ', positions.features.length)
return positions;
}
}
@Controller('airports')
export class AirportsController {
constructor(private readonly service: AirportsService) {}
@Get('geojson')
async getAll(): Promise<FeatureCollection>{
return this.service.getAirports()
}
}