diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.ts index 37693f160..5b10e381d 100644 --- a/apps/api/src/app/import/import.service.ts +++ b/apps/api/src/app/import/import.service.ts @@ -254,6 +254,7 @@ export class ImportService { countries: null, createdAt: undefined, id: undefined, + isin: null, name: null, scraperConfiguration: null, sectors: null, diff --git a/apps/api/src/services/data-gathering.service.ts b/apps/api/src/services/data-gathering.service.ts index 7eb84a20a..aef198e5b 100644 --- a/apps/api/src/services/data-gathering.service.ts +++ b/apps/api/src/services/data-gathering.service.ts @@ -127,11 +127,9 @@ export class DataGatheringService { ); for (const [symbol, assetProfile] of Object.entries(assetProfiles)) { - const symbolMapping = - assetProfile.symbolMapping ?? - symbolProfiles.find((symbolProfile) => { - return symbolProfile.symbol === symbol; - })?.symbolMapping; + const symbolMapping = symbolProfiles.find((symbolProfile) => { + return symbolProfile.symbol === symbol; + })?.symbolMapping; for (const dataEnhancer of this.dataEnhancers) { try { @@ -154,6 +152,7 @@ export class DataGatheringService { countries, currency, dataSource, + isin, name, sectors, url @@ -167,10 +166,10 @@ export class DataGatheringService { countries, currency, dataSource, + isin, name, sectors, symbol, - symbolMapping, url }, update: { @@ -178,9 +177,9 @@ export class DataGatheringService { assetSubClass, countries, currency, + isin, name, sectors, - symbolMapping, url }, where: { diff --git a/apps/api/src/services/data-provider/data-provider.service.ts b/apps/api/src/services/data-provider/data-provider.service.ts index 5b45c12f8..ad8929eee 100644 --- a/apps/api/src/services/data-provider/data-provider.service.ts +++ b/apps/api/src/services/data-provider/data-provider.service.ts @@ -323,6 +323,7 @@ export class DataProviderService { } private isPremiumDataSource(aDataSource: DataSource) { - return aDataSource === DataSource.EOD_HISTORICAL_DATA; + const premiumDataSources: DataSource[] = [DataSource.EOD_HISTORICAL_DATA]; + return premiumDataSources.includes(aDataSource); } } diff --git a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts index a7b0d45bd..f83016d63 100644 --- a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts +++ b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts @@ -37,18 +37,12 @@ export class EodHistoricalDataService implements DataProviderInterface { ): Promise> { const [searchResult] = await this.getSearchResult(aSymbol); - const symbolMapping = searchResult?.ISIN - ? { - ISIN: searchResult.ISIN - } - : undefined; - return { - symbolMapping, assetClass: searchResult?.assetClass, assetSubClass: searchResult?.assetSubClass, currency: searchResult?.currency, dataSource: this.getName(), + isin: searchResult?.ISIN, name: searchResult?.name }; } diff --git a/prisma/migrations/20230318081658_added_isin_to_symbol_profile/migration.sql b/prisma/migrations/20230318081658_added_isin_to_symbol_profile/migration.sql new file mode 100644 index 000000000..f7081354c --- /dev/null +++ b/prisma/migrations/20230318081658_added_isin_to_symbol_profile/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE "SymbolProfile" ADD COLUMN "isin" TEXT; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index dc4c1302d..dd46e52b6 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -119,6 +119,7 @@ model SymbolProfile { currency String dataSource DataSource id String @id @default(uuid()) + isin String? name String? updatedAt DateTime @updatedAt scraperConfiguration Json?