From 17504e88f7c22767984372e512728532a571ea35 Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Thu, 3 Feb 2022 18:02:08 +0100 Subject: [PATCH] Access dataSource and symbol from SymbolProfile --- apps/api/src/app/export/export.service.ts | 27 +++++++++++++++++-- .../app/portfolio/portfolio.service-new.ts | 7 +++-- .../src/app/portfolio/portfolio.service.ts | 7 +++-- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/apps/api/src/app/export/export.service.ts b/apps/api/src/app/export/export.service.ts index 784b34d5e..30b1ed082 100644 --- a/apps/api/src/app/export/export.service.ts +++ b/apps/api/src/app/export/export.service.ts @@ -17,7 +17,7 @@ export class ExportService { date: true, fee: true, quantity: true, - symbol: true, + SymbolProfile: true, type: true, unitPrice: true }, @@ -26,7 +26,30 @@ export class ExportService { return { meta: { date: new Date().toISOString(), version: environment.version }, - orders + orders: orders.map( + ({ + accountId, + currency, + date, + fee, + quantity, + SymbolProfile, + type, + unitPrice + }) => { + return { + accountId, + currency, + date, + fee, + quantity, + type, + unitPrice, + dataSource: SymbolProfile.dataSource, + symbol: SymbolProfile.symbol + }; + } + ) }; } } diff --git a/apps/api/src/app/portfolio/portfolio.service-new.ts b/apps/api/src/app/portfolio/portfolio.service-new.ts index d2aec3683..64d4ea0a0 100644 --- a/apps/api/src/app/portfolio/portfolio.service-new.ts +++ b/apps/api/src/app/portfolio/portfolio.service-new.ts @@ -407,8 +407,11 @@ export class PortfolioServiceNew { const orders = ( await this.orderService.getOrders({ userCurrency, userId }) - ).filter((order) => { - return order.dataSource === aDataSource && order.symbol === aSymbol; + ).filter(({ SymbolProfile }) => { + return ( + SymbolProfile.dataSource === aDataSource && + SymbolProfile.symbol === aSymbol + ); }); if (orders.length <= 0) { diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 9e4135a03..5cd06dc57 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -395,8 +395,11 @@ export class PortfolioService { const orders = ( await this.orderService.getOrders({ userCurrency, userId }) - ).filter((order) => { - return order.dataSource === aDataSource && order.symbol === aSymbol; + ).filter(({ SymbolProfile }) => { + return ( + SymbolProfile.dataSource === aDataSource && + SymbolProfile.symbol === aSymbol + ); }); if (orders.length <= 0) {