RED-9580 - added getOne method for stats service to call new users stats endpoint and updated data from "delete user dialog" with new backend data

This commit is contained in:
Valentin Mihai 2024-12-13 12:02:51 +02:00
parent 58382ddfee
commit fc8be33dc6

View File

@ -1,7 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { inject, Injectable } from '@angular/core';
import { BehaviorSubject, Observable, switchMap } from 'rxjs';
import { tap } from 'rxjs/operators';
import { map, tap } from 'rxjs/operators';
import { HeadersConfiguration } from '../utils/headers-configuration';
import { mapEach } from '../utils/operators';
@ -26,6 +26,14 @@ export abstract class StatsService<E, I = E> {
);
}
getOne(id: string): Observable<E> {
const request = this.#http.get<I>(`/${this._serviceName}/${encodeURI(this._defaultModelPath)}/${id}`, {
headers: HeadersConfiguration.getHeaders(),
});
return request.pipe(map(entity => new this._entityClass(entity)));
}
get(key: string): E {
return this._getBehaviourSubject(key).value;
}