Project

General

Profile

1
import {environment} from 'src/environments/environment';
2
import {Injectable} from '@angular/core';
3
import {GenericRestService} from './generic-rest.service';
4
import {HttpClient} from '@angular/common/http';
5
import {Observable} from 'rxjs';
6
import {DownloadingProcedureMetadata} from '../models/downloading-procedure-metadata.interface';
7
import {DownloadProcessTemp} from '../models/download-process-temp.interafce';
8
import {SentStringInterface} from '../models/sentString.interface';
9

    
10

    
11
@Injectable({
12
  providedIn: 'root'
13
})
14
export class InvoiceDownloadSchedulerService extends GenericRestService<DownloadProcessTemp> {
15

    
16
  constructor(private http: HttpClient) {
17
    super(`${environment.baseApiUrl}${environment.apiUrl.documentsProcessesWs}/downloading-procedure`, http);
18
  }
19

    
20
  public getAllByUserId(id:number): Observable<DownloadProcessTemp[]> {
21
    return this.http.get<DownloadProcessTemp[]>(this.baseUrl + '/all/' + id.toString());
22
  }
23

    
24
  public highPriority(id: string): Observable<SentStringInterface> {
25
    return this.http.get<SentStringInterface>(this.baseUrl + '/' + 'high-priority/' + id);
26
  }
27

    
28
  public reschedule(id: string): Observable<SentStringInterface> {
29
    return this.http.get<SentStringInterface>(this.baseUrl + '/' + 'reschedule/' + id);
30
  }
31

    
32
  public getAllDownloadingProcedure(): Observable<DownloadProcessTemp> {
33
    return this.http.get<DownloadProcessTemp>(this.baseUrl + '/all');
34
  }
35

    
36
  public getWorkspaces(): Observable<string[]> {
37
    return this.http.get<string[]>(this.baseUrl + '/workspace/all');
38
  }
39

    
40
  public getMetadata(): Observable<DownloadingProcedureMetadata> {
41
    return this.http.get<DownloadingProcedureMetadata>(this.baseUrl + '/metadata/latest');
42
  }
43

    
44
  public getStatuses(): Observable<string[]> {
45
    return this.http.get<string[]>(this.baseUrl + '/status/all');
46
  }
47

    
48
  public getTimeIntervals(): Observable<string[]> {
49
    return this.http.get<string[]>(this.baseUrl + '/time/interval/all');
50
  }
51

    
52
  public getCurrentFrequency(): Observable<SentStringInterface> {
53
    return this.http.get<SentStringInterface>(this.baseUrl + '/time/interval');
54
  }
55

    
56
  public updateTimeIntervals(frequency: string): Observable<string[]> {
57
    return this.http.put<string[]>(this.baseUrl + '/time/interval', null, {params: {frequency}});
58
  }
59
}
(13-13/21)