diff --git a/src/lib/services/api-path.interceptor.ts b/src/lib/services/api-path.interceptor.ts index 9d97ae1..ae1edcb 100644 --- a/src/lib/services/api-path.interceptor.ts +++ b/src/lib/services/api-path.interceptor.ts @@ -12,6 +12,7 @@ export class ApiPathInterceptor implements HttpInterceptor { intercept(req: HttpRequest, next: HttpHandler): Observable> { 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 })); } diff --git a/src/lib/services/generic.service.ts b/src/lib/services/generic.service.ts index daa5c2b..8721614 100644 --- a/src/lib/services/generic.service.ts +++ b/src/lib/services/generic.service.ts @@ -28,6 +28,7 @@ export abstract class GenericService { [ROOT_CHANGES_KEY, new Date(Date.now() - LAST_CHECKED_OFFSET).toISOString()], ]); protected abstract readonly _defaultModelPath: string; + protected readonly _serviceName: string = 'redaction-gateway-v1'; get(): Observable; get(): Observable; @@ -41,7 +42,7 @@ export abstract class GenericService { getAll(modelPath?: string, queryParams?: List): Observable; getAll(modelPath = this._defaultModelPath, queryParams?: List): Observable { this._updateLastChanged(); - return this._http.get(`/${encodeURI(modelPath)}`, { + return this._http.get(`/${this._serviceName}/${encodeURI(modelPath)}`, { headers: HeadersConfiguration.getHeaders({ contentType: false }), observe: 'body', params: this._queryParams(queryParams), @@ -54,10 +55,10 @@ export abstract class GenericService { } delete(body: unknown, modelPath = this._defaultModelPath, queryParams?: List): Observable { - 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 { const headers = HeadersConfiguration.getHeaders({ contentType: false }); - return this._http.post(`/${encodeURI(modelPath)}`, formParams, { + return this._http.post(`/${this._serviceName}/${encodeURI(modelPath)}`, formParams, { headers, observe: 'events', reportProgress: true, @@ -93,7 +94,7 @@ export abstract class GenericService { } protected _post(body: unknown, modelPath = this._defaultModelPath, queryParams?: List): Observable { - return this._http.post(`/${encodeURI(modelPath)}`, body, { + return this._http.post(`/${this._serviceName}/${encodeURI(modelPath)}`, body, { params: this._queryParams(queryParams), headers: HeadersConfiguration.getHeaders(), observe: 'body', @@ -101,7 +102,7 @@ export abstract class GenericService { } protected _put(body: unknown, modelPath = this._defaultModelPath, queryParams?: List): Observable { - return this._http.put(`/${encodeURI(modelPath)}`, body, { + return this._http.put(`/${this._serviceName}/${encodeURI(modelPath)}`, body, { params: this._queryParams(queryParams), headers: HeadersConfiguration.getHeaders(), observe: 'body', @@ -111,7 +112,7 @@ export abstract class GenericService { protected _getOne(path: List, modelPath = this._defaultModelPath, queryParams?: List): Observable { const entityPath = path.map(item => encodeURIComponent(item)).join('/'); - return this._http.get(`/${encodeURI(modelPath)}/${entityPath}`, { + return this._http.get(`/${this._serviceName}/${encodeURI(modelPath)}/${entityPath}`, { headers: HeadersConfiguration.getHeaders({ contentType: false }), params: this._queryParams(queryParams), observe: 'body', diff --git a/src/lib/services/iqser-user-preference.service.ts b/src/lib/services/iqser-user-preference.service.ts index aa5359c..0847e27 100644 --- a/src/lib/services/iqser-user-preference.service.ts +++ b/src/lib/services/iqser-user-preference.service.ts @@ -13,6 +13,7 @@ const KEYS = { @Injectable() export abstract class IqserUserPreferenceService extends GenericService { protected abstract readonly _devFeaturesEnabledKey: string; + protected readonly _serviceName: string = 'tenant-user-management'; #userAttributes: UserAttributes = {}; get userAttributes(): UserAttributes { diff --git a/src/lib/services/stats.service.ts b/src/lib/services/stats.service.ts index 658f594..062edf4 100644 --- a/src/lib/services/stats.service.ts +++ b/src/lib/services/stats.service.ts @@ -9,12 +9,13 @@ export abstract class StatsService { 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>(); getFor(ids: string[]): Observable { - const request = this.#http.post(`/${encodeURI(this._defaultModelPath)}`, ids, { + const request = this.#http.post(`/${this._serviceName}/${encodeURI(this._defaultModelPath)}`, ids, { headers: HeadersConfiguration.getHeaders(), observe: 'body', }); diff --git a/src/lib/tenants/services/tenants.service.ts b/src/lib/tenants/services/tenants.service.ts index 0422205..6036ab3 100644 --- a/src/lib/tenants/services/tenants.service.ts +++ b/src/lib/tenants/services/tenants.service.ts @@ -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(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('/tenants/simple')); + const tenants = await firstValueFrom(this.#http.get(`/${this._serviceName}/tenants/simple`)); this.tenants.set(tenants); const tenant = this.getTenantFromRoute(); diff --git a/src/lib/users/services/iqser-user.service.ts b/src/lib/users/services/iqser-user.service.ts index f7426c4..3672efc 100644 --- a/src/lib/users/services/iqser-user.service.ts +++ b/src/lib/users/services/iqser-user.service.ts @@ -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();