diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c2ca72e..d7f02a4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Changed + +- Used `dataSource` and `symbol` from `SymbolProfile` instead of the `order` object (in `ExportService` and `PortfolioService`) + ## 1.110.0 - 02.02.2022 ### Fixed diff --git a/apps/api/src/app/export/export.service.ts b/apps/api/src/app/export/export.service.ts index 784b34d5..30b1ed08 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 d2aec368..64d4ea0a 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 9e4135a0..5cd06dc5 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) {