Browse Source

Access dataSource and symbol from SymbolProfile

pull/668/head
Thomas 3 years ago
parent
commit
17504e88f7
  1. 27
      apps/api/src/app/export/export.service.ts
  2. 7
      apps/api/src/app/portfolio/portfolio.service-new.ts
  3. 7
      apps/api/src/app/portfolio/portfolio.service.ts

27
apps/api/src/app/export/export.service.ts

@ -17,7 +17,7 @@ export class ExportService {
date: true, date: true,
fee: true, fee: true,
quantity: true, quantity: true,
symbol: true, SymbolProfile: true,
type: true, type: true,
unitPrice: true unitPrice: true
}, },
@ -26,7 +26,30 @@ export class ExportService {
return { return {
meta: { date: new Date().toISOString(), version: environment.version }, 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
};
}
)
}; };
} }
} }

7
apps/api/src/app/portfolio/portfolio.service-new.ts

@ -407,8 +407,11 @@ export class PortfolioServiceNew {
const orders = ( const orders = (
await this.orderService.getOrders({ userCurrency, userId }) await this.orderService.getOrders({ userCurrency, userId })
).filter((order) => { ).filter(({ SymbolProfile }) => {
return order.dataSource === aDataSource && order.symbol === aSymbol; return (
SymbolProfile.dataSource === aDataSource &&
SymbolProfile.symbol === aSymbol
);
}); });
if (orders.length <= 0) { if (orders.length <= 0) {

7
apps/api/src/app/portfolio/portfolio.service.ts

@ -395,8 +395,11 @@ export class PortfolioService {
const orders = ( const orders = (
await this.orderService.getOrders({ userCurrency, userId }) await this.orderService.getOrders({ userCurrency, userId })
).filter((order) => { ).filter(({ SymbolProfile }) => {
return order.dataSource === aDataSource && order.symbol === aSymbol; return (
SymbolProfile.dataSource === aDataSource &&
SymbolProfile.symbol === aSymbol
);
}); });
if (orders.length <= 0) { if (orders.length <= 0) {

Loading…
Cancel
Save