diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 3536169f2..5c995c182 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -492,13 +492,10 @@ export class PortfolioService { symbol: position.symbol }; }); - const symbols = currentPositions.positions.map( - (position) => position.symbol - ); const [dataProviderResponses, symbolProfiles] = await Promise.all([ this.dataProviderService.getQuotes(dataGatheringItems), - this.symbolProfileService.getSymbolProfilesBySymbols(symbols) + this.symbolProfileService.getSymbolProfiles(dataGatheringItems) ]); const symbolProfileMap: { [symbol: string]: EnhancedSymbolProfile } = {}; @@ -986,11 +983,13 @@ export class PortfolioService { }; }); - const symbols = positions.map((position) => position.symbol); - const [dataProviderResponses, symbolProfiles] = await Promise.all([ this.dataProviderService.getQuotes(dataGatheringItem), - this.symbolProfileService.getSymbolProfilesBySymbols(symbols) + this.symbolProfileService.getSymbolProfiles( + positions.map(({ dataSource, symbol }) => { + return { dataSource, symbol }; + }) + ) ]); const symbolProfileMap: { [symbol: string]: EnhancedSymbolProfile } = {}; diff --git a/apps/api/src/services/data-gathering/data-gathering.service.ts b/apps/api/src/services/data-gathering/data-gathering.service.ts index a238e02fc..fc77bdc60 100644 --- a/apps/api/src/services/data-gathering/data-gathering.service.ts +++ b/apps/api/src/services/data-gathering/data-gathering.service.ts @@ -123,12 +123,9 @@ export class DataGatheringService { const assetProfiles = await this.dataProviderService.getAssetProfiles( uniqueAssets ); - const symbolProfiles = - await this.symbolProfileService.getSymbolProfilesBySymbols( - uniqueAssets.map(({ symbol }) => { - return symbol; - }) - ); + const symbolProfiles = await this.symbolProfileService.getSymbolProfiles( + uniqueAssets + ); for (const [symbol, assetProfile] of Object.entries(assetProfiles)) { const symbolMapping = symbolProfiles.find((symbolProfile) => { diff --git a/apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts b/apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts index 1c24f2638..fb182167f 100644 --- a/apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts +++ b/apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts @@ -109,8 +109,14 @@ export class GoogleSheetsService implements DataProviderInterface { try { const response: { [symbol: string]: IDataProviderResponse } = {}; - const symbolProfiles = - await this.symbolProfileService.getSymbolProfilesBySymbols(aSymbols); + const symbolProfiles = await this.symbolProfileService.getSymbolProfiles( + aSymbols.map((symbol) => { + return { + symbol, + dataSource: this.getName() + }; + }) + ); const sheet = await this.getSheet({ sheetId: this.configurationService.get('GOOGLE_SHEETS_ID'), diff --git a/apps/api/src/services/data-provider/manual/manual.service.ts b/apps/api/src/services/data-provider/manual/manual.service.ts index ccc737695..65035d13f 100644 --- a/apps/api/src/services/data-provider/manual/manual.service.ts +++ b/apps/api/src/services/data-provider/manual/manual.service.ts @@ -64,8 +64,9 @@ export class ManualService implements DataProviderInterface { try { const symbol = aSymbol; - const [symbolProfile] = - await this.symbolProfileService.getSymbolProfilesBySymbols([symbol]); + const [symbolProfile] = await this.symbolProfileService.getSymbolProfiles( + [{ symbol, dataSource: this.getName() }] + ); const { defaultMarketPrice, selector, url } = symbolProfile.scraperConfiguration ?? {}; @@ -128,8 +129,11 @@ export class ManualService implements DataProviderInterface { } try { - const symbolProfiles = - await this.symbolProfileService.getSymbolProfilesBySymbols(aSymbols); + const symbolProfiles = await this.symbolProfileService.getSymbolProfiles( + aSymbols.map((symbol) => { + return { symbol, dataSource: this.getName() }; + }) + ); const marketData = await this.prismaService.marketData.findMany({ distinct: ['symbol'], diff --git a/apps/api/src/services/symbol-profile/symbol-profile.service.ts b/apps/api/src/services/symbol-profile/symbol-profile.service.ts index d78270cac..a27a0645d 100644 --- a/apps/api/src/services/symbol-profile/symbol-profile.service.ts +++ b/apps/api/src/services/symbol-profile/symbol-profile.service.ts @@ -87,29 +87,6 @@ export class SymbolProfileService { .then((symbolProfiles) => this.getSymbols(symbolProfiles)); } - /** - * @deprecated - */ - public async getSymbolProfilesBySymbols( - symbols: string[] - ): Promise { - return this.prismaService.symbolProfile - .findMany({ - include: { - _count: { - select: { Order: true } - }, - SymbolProfileOverrides: true - }, - where: { - symbol: { - in: symbols - } - } - }) - .then((symbolProfiles) => this.getSymbols(symbolProfiles)); - } - public updateSymbolProfile({ comment, dataSource,