|
|
|
@ -59,7 +59,9 @@ export class SymbolProfileService {
|
|
|
|
|
return symbolProfiles.map((symbolProfile) => {
|
|
|
|
|
const item = {
|
|
|
|
|
...symbolProfile,
|
|
|
|
|
countries: this.getCountries(symbolProfile),
|
|
|
|
|
countries: this.getCountries(
|
|
|
|
|
symbolProfile?.countries as unknown as Prisma.JsonArray
|
|
|
|
|
),
|
|
|
|
|
scraperConfiguration: this.getScraperConfiguration(symbolProfile),
|
|
|
|
|
sectors: this.getSectors(symbolProfile),
|
|
|
|
|
symbolMapping: this.getSymbolMapping(symbolProfile)
|
|
|
|
@ -70,9 +72,17 @@ export class SymbolProfileService {
|
|
|
|
|
item.SymbolProfileOverrides.assetClass ?? item.assetClass;
|
|
|
|
|
item.assetSubClass =
|
|
|
|
|
item.SymbolProfileOverrides.assetSubClass ?? item.assetSubClass;
|
|
|
|
|
item.countries =
|
|
|
|
|
(item.SymbolProfileOverrides.countries as unknown as Country[]) ??
|
|
|
|
|
item.countries;
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
(item.SymbolProfileOverrides.countries as unknown as Prisma.JsonArray)
|
|
|
|
|
?.length > 0
|
|
|
|
|
) {
|
|
|
|
|
item.countries = this.getCountries(
|
|
|
|
|
item.SymbolProfileOverrides
|
|
|
|
|
?.countries as unknown as Prisma.JsonArray
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
item.name = item.SymbolProfileOverrides?.name ?? item.name;
|
|
|
|
|
item.sectors =
|
|
|
|
|
(item.SymbolProfileOverrides.sectors as unknown as Sector[]) ??
|
|
|
|
@ -85,20 +95,22 @@ export class SymbolProfileService {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private getCountries(symbolProfile: SymbolProfile): Country[] {
|
|
|
|
|
return ((symbolProfile?.countries as Prisma.JsonArray) ?? []).map(
|
|
|
|
|
(country) => {
|
|
|
|
|
const { code, weight } = country as Prisma.JsonObject;
|
|
|
|
|
private getCountries(aCountries: Prisma.JsonArray = []): Country[] {
|
|
|
|
|
if (aCountries === null) {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
code: code as string,
|
|
|
|
|
continent:
|
|
|
|
|
continents[countries[code as string]?.continent] ?? UNKNOWN_KEY,
|
|
|
|
|
name: countries[code as string]?.name ?? UNKNOWN_KEY,
|
|
|
|
|
weight: weight as number
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
return aCountries.map((country: Pick<Country, 'code' | 'weight'>) => {
|
|
|
|
|
const { code, weight } = country;
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
code,
|
|
|
|
|
weight,
|
|
|
|
|
continent:
|
|
|
|
|
continents[countries[code as string]?.continent] ?? UNKNOWN_KEY,
|
|
|
|
|
name: countries[code as string]?.name ?? UNKNOWN_KEY
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private getScraperConfiguration(
|
|
|
|
|