|
@ -301,6 +301,12 @@ export class OrderService { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (withExcludedAccounts === false) { |
|
|
|
|
|
where.Account = { |
|
|
|
|
|
NOT: { isExcluded: true } |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const [orders, count] = await Promise.all([ |
|
|
const [orders, count] = await Promise.all([ |
|
|
this.orders({ |
|
|
this.orders({ |
|
|
orderBy, |
|
|
orderBy, |
|
@ -322,32 +328,24 @@ export class OrderService { |
|
|
this.prismaService.order.count({ where }) |
|
|
this.prismaService.order.count({ where }) |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
const activities = orders |
|
|
const activities = orders.map((order) => { |
|
|
.filter((order) => { |
|
|
const value = new Big(order.quantity).mul(order.unitPrice).toNumber(); |
|
|
return ( |
|
|
|
|
|
withExcludedAccounts || |
|
|
return { |
|
|
!order.Account || |
|
|
...order, |
|
|
order.Account?.isExcluded === false |
|
|
value, |
|
|
); |
|
|
feeInBaseCurrency: this.exchangeRateDataService.toCurrency( |
|
|
}) |
|
|
order.fee, |
|
|
.map((order) => { |
|
|
order.SymbolProfile.currency, |
|
|
const value = new Big(order.quantity).mul(order.unitPrice).toNumber(); |
|
|
userCurrency |
|
|
|
|
|
), |
|
|
return { |
|
|
valueInBaseCurrency: this.exchangeRateDataService.toCurrency( |
|
|
...order, |
|
|
|
|
|
value, |
|
|
value, |
|
|
feeInBaseCurrency: this.exchangeRateDataService.toCurrency( |
|
|
order.SymbolProfile.currency, |
|
|
order.fee, |
|
|
userCurrency |
|
|
order.SymbolProfile.currency, |
|
|
) |
|
|
userCurrency |
|
|
}; |
|
|
), |
|
|
}); |
|
|
valueInBaseCurrency: this.exchangeRateDataService.toCurrency( |
|
|
|
|
|
value, |
|
|
|
|
|
order.SymbolProfile.currency, |
|
|
|
|
|
userCurrency |
|
|
|
|
|
) |
|
|
|
|
|
}; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return { activities, count }; |
|
|
return { activities, count }; |
|
|
} |
|
|
} |
|
|