Merge branch 'RED-6686' into 'master'
Red 6686 See merge request fforesight/shared-ui-libraries/common-ui!1
This commit is contained in:
commit
3cef35f3bf
@ -12,6 +12,7 @@ export class ApiPathInterceptor implements HttpInterceptor {
|
||||
intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
|
||||
if (!req.url.startsWith('/assets')) {
|
||||
const apiUrl = `${this.#config.API_URL}${req.url}`;
|
||||
console.log('API URL: ', apiUrl);
|
||||
return next.handle(req.clone({ url: apiUrl }));
|
||||
}
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ export abstract class GenericService<I> {
|
||||
[ROOT_CHANGES_KEY, new Date(Date.now() - LAST_CHECKED_OFFSET).toISOString()],
|
||||
]);
|
||||
protected abstract readonly _defaultModelPath: string;
|
||||
protected readonly _serviceName: string = 'redaction-gateway-v1';
|
||||
|
||||
get<T = I[]>(): Observable<T>;
|
||||
get<T extends I[]>(): Observable<T>;
|
||||
@ -41,7 +42,7 @@ export abstract class GenericService<I> {
|
||||
getAll<R = I[]>(modelPath?: string, queryParams?: List<QueryParam>): Observable<R>;
|
||||
getAll<R = I[]>(modelPath = this._defaultModelPath, queryParams?: List<QueryParam>): Observable<R> {
|
||||
this._updateLastChanged();
|
||||
return this._http.get<R>(`/${encodeURI(modelPath)}`, {
|
||||
return this._http.get<R>(`/${this._serviceName}/${encodeURI(modelPath)}`, {
|
||||
headers: HeadersConfiguration.getHeaders({ contentType: false }),
|
||||
observe: 'body',
|
||||
params: this._queryParams(queryParams),
|
||||
@ -54,10 +55,10 @@ export abstract class GenericService<I> {
|
||||
}
|
||||
|
||||
delete(body: unknown, modelPath = this._defaultModelPath, queryParams?: List<QueryParam>): Observable<unknown> {
|
||||
let path = `/${encodeURI(modelPath)}`;
|
||||
let path = `/${this._serviceName}/${encodeURI(modelPath)}`;
|
||||
|
||||
if (typeof body === 'string') {
|
||||
path += `/${encodeURIComponent(body)}`;
|
||||
path += `/${this._serviceName}/${encodeURIComponent(body)}`;
|
||||
}
|
||||
|
||||
return this._http.delete(path, {
|
||||
@ -77,7 +78,7 @@ export abstract class GenericService<I> {
|
||||
|
||||
const headers = HeadersConfiguration.getHeaders({ contentType: false });
|
||||
|
||||
return this._http.post<R>(`/${encodeURI(modelPath)}`, formParams, {
|
||||
return this._http.post<R>(`/${this._serviceName}/${encodeURI(modelPath)}`, formParams, {
|
||||
headers,
|
||||
observe: 'events',
|
||||
reportProgress: true,
|
||||
@ -93,7 +94,7 @@ export abstract class GenericService<I> {
|
||||
}
|
||||
|
||||
protected _post<R = I>(body: unknown, modelPath = this._defaultModelPath, queryParams?: List<QueryParam>): Observable<R> {
|
||||
return this._http.post<R>(`/${encodeURI(modelPath)}`, body, {
|
||||
return this._http.post<R>(`/${this._serviceName}/${encodeURI(modelPath)}`, body, {
|
||||
params: this._queryParams(queryParams),
|
||||
headers: HeadersConfiguration.getHeaders(),
|
||||
observe: 'body',
|
||||
@ -101,7 +102,7 @@ export abstract class GenericService<I> {
|
||||
}
|
||||
|
||||
protected _put<R = I>(body: unknown, modelPath = this._defaultModelPath, queryParams?: List<QueryParam>): Observable<R> {
|
||||
return this._http.put<R>(`/${encodeURI(modelPath)}`, body, {
|
||||
return this._http.put<R>(`/${this._serviceName}/${encodeURI(modelPath)}`, body, {
|
||||
params: this._queryParams(queryParams),
|
||||
headers: HeadersConfiguration.getHeaders(),
|
||||
observe: 'body',
|
||||
@ -111,7 +112,7 @@ export abstract class GenericService<I> {
|
||||
protected _getOne<R = I>(path: List, modelPath = this._defaultModelPath, queryParams?: List<QueryParam>): Observable<R> {
|
||||
const entityPath = path.map(item => encodeURIComponent(item)).join('/');
|
||||
|
||||
return this._http.get<R>(`/${encodeURI(modelPath)}/${entityPath}`, {
|
||||
return this._http.get<R>(`/${this._serviceName}/${encodeURI(modelPath)}/${entityPath}`, {
|
||||
headers: HeadersConfiguration.getHeaders({ contentType: false }),
|
||||
params: this._queryParams(queryParams),
|
||||
observe: 'body',
|
||||
|
||||
@ -13,6 +13,7 @@ const KEYS = {
|
||||
@Injectable()
|
||||
export abstract class IqserUserPreferenceService extends GenericService<UserAttributes> {
|
||||
protected abstract readonly _devFeaturesEnabledKey: string;
|
||||
protected readonly _serviceName: string = 'tenant-user-management';
|
||||
#userAttributes: UserAttributes = {};
|
||||
|
||||
get userAttributes(): UserAttributes {
|
||||
|
||||
@ -9,12 +9,13 @@ export abstract class StatsService<E, I = E> {
|
||||
protected abstract readonly _primaryKey: string;
|
||||
protected abstract readonly _entityClass: new (entityInterface: I, ...args: unknown[]) => E;
|
||||
protected abstract readonly _defaultModelPath: string;
|
||||
protected readonly _serviceName: string = 'redaction-gateway-v1';
|
||||
|
||||
readonly #http = inject(HttpClient);
|
||||
readonly #map = new Map<string, BehaviorSubject<E>>();
|
||||
|
||||
getFor(ids: string[]): Observable<E[]> {
|
||||
const request = this.#http.post<I[]>(`/${encodeURI(this._defaultModelPath)}`, ids, {
|
||||
const request = this.#http.post<I[]>(`/${this._serviceName}/${encodeURI(this._defaultModelPath)}`, ids, {
|
||||
headers: HeadersConfiguration.getHeaders(),
|
||||
observe: 'body',
|
||||
});
|
||||
|
||||
@ -32,6 +32,7 @@ const STORED_TENANTS_KEY = 'red-stored-tenants';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class TenantsService {
|
||||
protected readonly _serviceName: string = 'tenant-user-management';
|
||||
readonly tenants = signal<IBaseTenant[] | undefined>(undefined);
|
||||
readonly hasMultiple = computed(() => {
|
||||
const tenants = this.tenants();
|
||||
@ -60,7 +61,7 @@ export class TenantsService {
|
||||
|
||||
async loadTenants() {
|
||||
this.#logger.info('[TENANTS] Loading tenants...');
|
||||
const tenants = await firstValueFrom(this.#http.get<IBaseTenant[]>('/tenants/simple'));
|
||||
const tenants = await firstValueFrom(this.#http.get<IBaseTenant[]>(`/${this._serviceName}/tenants/simple`));
|
||||
this.tenants.set(tenants);
|
||||
|
||||
const tenant = this.getTenantFromRoute();
|
||||
|
||||
@ -36,6 +36,7 @@ export abstract class IqserUserService<
|
||||
protected readonly _permissionsService = inject(IqserPermissionsService, { optional: true });
|
||||
protected readonly _rolesService = inject(IqserRolesService, { optional: true });
|
||||
protected readonly _baseHref = inject(BASE_HREF);
|
||||
protected readonly _serviceName: string = 'tenant-user-management';
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user