Commit f0d05796 authored by Florent POITTEVIN's avatar Florent POITTEVIN
Browse files

refacto: api enum by removing use environment api url

parent 89f4a1cc
import {ApiModuleEnum} from "@app/shared/enums/api-module.enum";
import {ApiResourceNameEnum} from "@app/shared/enums/api-resource-name.enum";
import {environment} from "@environments/environment";
import {Storage} from "@shared/models/storage.model";
import {ResourceApiEnum} from "solidify-frontend";
import {environment} from "../../../environments/environment";
import {
isNullOrUndefined,
ResourceApiEnum,
} from "solidify-frontend";
export class ApiKeyword {
static PARENT_ID: string = "parentId";
......@@ -17,49 +20,47 @@ const search = "search";
const api = "api";
const apiInUrl = SEPARATOR + api + SEPARATOR;
const useEnvironmentApiUrl: boolean = environment.production === true || environment.forceRuntimeOverrideSetting === true;
export class BaseResourceApiEnum {
static get access(): string {
return (useEnvironmentApiUrl ? environment.ACCESS_APPLICATION : apiInUrl) + ApiModuleEnum.ACCESS;
return (!isNullOrUndefined(environment.ACCESS_APPLICATION) ? environment.ACCESS_APPLICATION : apiInUrl) + ApiModuleEnum.ACCESS;
}
static get admin(): string {
return (useEnvironmentApiUrl ? environment.ADMIN_APPLICATION : apiInUrl) + ApiModuleEnum.ADMIN;
return (!isNullOrUndefined(environment.ADMIN_APPLICATION) ? environment.ADMIN_APPLICATION : apiInUrl) + ApiModuleEnum.ADMIN;
}
static get dataMgmt(): string {
return (useEnvironmentApiUrl ? environment.ADMIN_APPLICATION : apiInUrl) + ApiModuleEnum.DATAMGMT;
return (!isNullOrUndefined(environment.ADMIN_APPLICATION) ? environment.ADMIN_APPLICATION : apiInUrl) + ApiModuleEnum.DATAMGMT;
}
static get resourceSrv(): string {
return (useEnvironmentApiUrl ? environment.ADMIN_APPLICATION : apiInUrl) + ApiModuleEnum.RES_SRV;
return (!isNullOrUndefined(environment.ADMIN_APPLICATION) ? environment.ADMIN_APPLICATION : apiInUrl) + ApiModuleEnum.RES_SRV;
}
static get preservationPlanning(): string {
return (useEnvironmentApiUrl ? environment.ADMIN_APPLICATION : apiInUrl) + ApiModuleEnum.PRES_PLANNING;
return (!isNullOrUndefined(environment.ADMIN_APPLICATION) ? environment.ADMIN_APPLICATION : apiInUrl) + ApiModuleEnum.PRES_PLANNING;
}
static get ingest(): string {
return (useEnvironmentApiUrl ? environment.INGEST_APPLICATION : apiInUrl) + ApiModuleEnum.INGEST;
return (!isNullOrUndefined(environment.INGEST_APPLICATION) ? environment.INGEST_APPLICATION : apiInUrl) + ApiModuleEnum.INGEST;
}
static get preingest(): string {
return (useEnvironmentApiUrl ? environment.INGEST_APPLICATION : apiInUrl) + ApiModuleEnum.PREINGEST;
return (!isNullOrUndefined(environment.INGEST_APPLICATION) ? environment.INGEST_APPLICATION : apiInUrl) + ApiModuleEnum.PREINGEST;
}
static get archivalStorage(): string {
return (useEnvironmentApiUrl ? environment.STORAGION_APPLICATION : apiInUrl) + ApiModuleEnum.ARCHIVALSTORAGE;
return (!isNullOrUndefined(environment.STORAGION_APPLICATION) ? environment.STORAGION_APPLICATION : apiInUrl) + ApiModuleEnum.ARCHIVALSTORAGE;
}
static get docs(): string {
return (useEnvironmentApiUrl ? environment.ADMIN_APPLICATION : apiInUrl) + ApiModuleEnum.DOCS;
return (!isNullOrUndefined(environment.ADMIN_APPLICATION) ? environment.ADMIN_APPLICATION : apiInUrl) + ApiModuleEnum.DOCS;
}
static get archivalStorageAip(): Storage[] {
const newList: Storage[] = [];
environment.storagionUrls.forEach(url => {
newList.push({index: url.index, url: (useEnvironmentApiUrl ? url.url : apiInUrl) + ApiModuleEnum.ARCHIVALSTORAGE});
newList.push({index: url.index, url: (!isNullOrUndefined(url.url) ? url.url : apiInUrl) + ApiModuleEnum.ARCHIVALSTORAGE});
});
return newList;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment