Update on the tunnel flight
This commit is contained in:
@@ -4,7 +4,7 @@ import { HttpClient } from "@angular/common/http";
|
||||
import { Observable } from "rxjs";
|
||||
import { map } from "rxjs/operators";
|
||||
|
||||
import { TunnelFlightReq, TunnelFlightResp, TunnelFlight } from "../models/tunnel-flight";
|
||||
import { TunnelFlightReq, TunnelFlightResp, TunnelFlight, TunnelFlightByMonthResp, TunnelFlightByMonth } from "../models/tunnel-flight";
|
||||
import { DropZoneResp } from '../models/dropzone';
|
||||
|
||||
import { BaseService } from "./base.service";
|
||||
@@ -45,6 +45,19 @@ export class TunnelFlightService extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
public getTunnelFlightsByMonth(begin: Date, end: Date): Observable<Array<TunnelFlightByMonth>> {
|
||||
let beginDate = this.datePipe.transform(begin, "yyyy-MM-dd");
|
||||
let endDate = this.datePipe.transform(end, "yyyy-MM-dd");
|
||||
|
||||
return this.http.get<Array<TunnelFlightByMonthResp>>(`${this.apiUrl}/TunnelFlight/month/${beginDate}/${endDate}`, { headers: this.headers })
|
||||
.pipe(
|
||||
map(response => {
|
||||
const stats = response.map(data => new TunnelFlightByMonth(data));
|
||||
return stats;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private mapWithDataInCache(apiResp: Array<TunnelFlightResp>): Array<TunnelFlight> {
|
||||
let allDropzones: Array<DropZoneResp>;
|
||||
this.dropzoneService.getFromCache().subscribe(data => { allDropzones = data; });
|
||||
|
||||
Reference in New Issue
Block a user