Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/upgrade countries list to version 3.1.0 (#3131)
Thomas Kauld32dd5e8605a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 44b641f7f0..f7ca1dc34c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- Extended the content of the _Self-Hosting_ section by available home server systems on the Frequently Asked Questions (FAQ) page+### Changed++- Upgraded `countries-list` from version `2.6.1` to `3.1.0`+### Fixed- Fixed an issue in the performance calculation caused by multiple `SELL` activities on the same daydiff --git a/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts b/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.tsindex 63d7852537..ddc3d79f80 100644--- a/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts+++ b/apps/api/src/services/data-provider/data-enhancer/trackinsight/trackinsight.service.ts@@ -5,12 +5,12 @@ import { Sector } from '@ghostfolio/common/interfaces/sector.interface';import { Injectable } from '@nestjs/common';import { SymbolProfile } from '@prisma/client';+import { countries } from 'countries-list';import got from 'got';@Injectable()export class TrackinsightDataEnhancerService implements DataEnhancerInterface {private static baseUrl = 'https://www.trackinsight.com/data-api';- private static countries = require('countries-list/dist/countries.json');private static countriesMapping = {'Russian Federation': 'Russia'};@@ -131,20 +131,19 @@ export class TrackinsightDataEnhancerService implements DataEnhancerInterface {(response.countries as unknown as Country[]).length === 0) {response.countries = [];+for (const [name, value] of Object.entries<any>(holdings?.countries ?? {})) {let countryCode: string;- for (const [key, country] of Object.entries<any>(- TrackinsightDataEnhancerService.countries- )) {+ for (const [code, country] of Object.entries(countries)) {if (country.name === name ||country.name ===TrackinsightDataEnhancerService.countriesMapping[name]) {- countryCode = key;+ countryCode = code;break;}}diff --git a/apps/api/src/services/symbol-profile/symbol-profile.service.ts b/apps/api/src/services/symbol-profile/symbol-profile.service.tsindex a87b00d95d..751feda22a 100644--- a/apps/api/src/services/symbol-profile/symbol-profile.service.ts+++ b/apps/api/src/services/symbol-profile/symbol-profile.service.ts@@ -189,9 +189,8 @@ export class SymbolProfileService {return {code,weight,- continent:- continents[countries[code as string]?.continent] ?? UNKNOWN_KEY,- name: countries[code as string]?.name ?? UNKNOWN_KEY+ continent: continents[countries[code]?.continent] ?? UNKNOWN_KEY,+ name: countries[code]?.name ?? UNKNOWN_KEY};});}diff --git a/package.json b/package.jsonindex ddd5de1cf7..5b92172e4b 100644--- a/package.json+++ b/package.json@@ -102,7 +102,7 @@"class-validator": "0.14.0","color": "4.2.3","countries-and-timezones": "3.4.1",- "countries-list": "2.6.1",+ "countries-list": "3.1.0","countup.js": "2.3.2","date-fns": "2.29.3","envalid": "7.3.1",diff --git a/yarn.lock b/yarn.lockindex f71e7ad80f..ba7e811ef4 100644--- a/yarn.lock+++ b/yarn.lock@@ -9739,10 +9739,10 @@ [email protected]:resolved "https://registry.yarnpkg.com/countries-and-timezones/-/countries-and-timezones-3.4.1.tgz#0ec2540f57e42f0f740eb2acaede786043347fe1"integrity sha512-INeHGCony4XUUR8iGL/lmt9s1Oi+n+gFHeJAMfbV5hJfYeDOB8JG1oxz5xFQu5oBZoRCJe/87k1Vzue9DoIauA==- version "2.6.1"- resolved "https://registry.yarnpkg.com/countries-list/-/countries-list-2.6.1.tgz#d479757ac873b1e596ccea0a925962d20396c0cb"- integrity sha512-jXM1Nv3U56dPQ1DsUSsEaGmLHburo4fnB7m+1yhWDUVvx5gXCd1ok/y3gXCjXzhqyawG+igcPYcAl4qjkvopaQ==+ version "3.1.0"+ resolved "https://registry.yarnpkg.com/countries-list/-/countries-list-3.1.0.tgz#1cbe32f58659c7d6a1e744917689f24c84333ea8"+ integrity sha512-HpTBLZba1VPTZSjUnUwR7SykxV7Z/7/+ZM5x5wi5tO99Qvom6bE2SC+AQ18016ujg3jSlYBbMITrHNnPAHSM9Q==version "2.3.2"