argos/dmp-frontend/src/app/core/services/maintenance/maintenance.service.ts

46 lines
1.4 KiB
TypeScript

import { Injectable } from "@angular/core";
import { BaseService } from "@common/base/base.service";
import { Observable, throwError } from "rxjs";
import { catchError } from "rxjs/operators";
import { ConfigurationService } from "../configuration/configuration.service";
import { BaseHttpV2Service } from "../http/base-http-v2.service";
@Injectable()
export class MaintenanceService extends BaseService {
constructor(
private http: BaseHttpV2Service,
private installationConfiguration: ConfigurationService,
) { super(); }
private get apiBase(): string { return `${this.installationConfiguration.server}maintenance`; }
generateElasticIndex(): Observable<any> {
const url = `${this.apiBase}/index/elastic`;
return this.http
.post<any>(url, null).pipe(
catchError((error: any) => throwError(error)));
}
clearElasticIndex(): Observable<any> {
const url = `${this.apiBase}/index/elastic`;
return this.http
.delete<any>(url).pipe(
catchError((error: any) => throwError(error)));
}
sendUserTouchEvents(): Observable<any> {
const url = `${this.apiBase}/events/users/touch`;
return this.http
.delete<any>(url).pipe(
catchError((error: any) => throwError(error)));
}
sendTenantTouchEvents(): Observable<any> {
const url = `${this.apiBase}/events/tenant/touch`;
return this.http
.delete<any>(url).pipe(
catchError((error: any) => throwError(error)));
}
}