blob: e0057bb4d3e264b78fefc26cbd662ae3d6e8be1f [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001import {Injectable} from '@angular/core';
2import {Observable} from 'rxjs/Observable';
3import {ServiceInfoModel} from './serviceInfo.model';
4import {HttpClient} from '@angular/common/http';
5import 'rxjs/add/operator/map'
6import {Constants} from '../../utils/constants';
7import {forkJoin} from "rxjs/observable/forkJoin";
8
9@Injectable()
10export 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}