Sonsino, Ofir (os0695) | ff76b5e | 2018-07-10 15:57:37 +0300 | [diff] [blame^] | 1 | import {Injectable} from '@angular/core'; |
| 2 | import {Observable} from 'rxjs/Observable'; |
| 3 | import {ServiceInfoModel} from './serviceInfo.model'; |
| 4 | import {HttpClient} from '@angular/common/http'; |
| 5 | import 'rxjs/add/operator/map' |
| 6 | import {Constants} from '../../utils/constants'; |
| 7 | import {forkJoin} from "rxjs/observable/forkJoin"; |
| 8 | |
| 9 | @Injectable() |
| 10 | export class ServiceInfoService { |
| 11 | constructor(private _http: HttpClient) { |
| 12 | } |
| 13 | |
| 14 | getServicesJobInfo(filterByUser : boolean): Observable<ServiceInfoModel[]> { |
| 15 | let pathQuery = Constants.Path.SERVICES_JOB_INFO_PATH; |
| 16 | return this._http.get<ServiceInfoModel[]>(pathQuery).map(res => res ); |
| 17 | } |
| 18 | |
| 19 | deleteJob(jobId: string): Observable<any> { |
| 20 | let pathQuery = Constants.Path.SERVICES_JOB_INFO_PATH + '/job/' + jobId; |
| 21 | return this._http.delete<any>(pathQuery).map(res => res); |
| 22 | } |
| 23 | |
| 24 | hideJob(jobId: string): Observable<any> { |
| 25 | let pathQuery = Constants.Path.SERVICES_JOB_INFO_PATH + '/hide/' + jobId; |
| 26 | return this._http.post<any>(pathQuery, null).map(res => res); |
| 27 | } |
| 28 | |
| 29 | getJobAuditStatus(jobId : string) : Observable<Object[]>{ |
| 30 | let pathQueryVID = Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + jobId + '?source=VID'; |
| 31 | let pathQueryMSO = Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + jobId + '?source=MSO'; |
| 32 | |
| 33 | let vidObs = this._http.get(pathQueryVID); |
| 34 | let msoObs = this._http.get(pathQueryMSO); |
| 35 | return forkJoin([vidObs, msoObs]); |
| 36 | } |
| 37 | |
| 38 | } |