Browse Source

Refactoring

pull/2198/head
Thomas 2 years ago
parent
commit
7ba6340a78
  1. 24
      apps/api/src/app/import/import.service.ts

24
apps/api/src/app/import/import.service.ts

@ -255,10 +255,20 @@ export class ImportService {
error, error,
fee, fee,
quantity, quantity,
SymbolProfile: assetProfile, SymbolProfile,
type, type,
unitPrice unitPrice
} of activitiesExtendedWithErrors) { } of activitiesExtendedWithErrors) {
const assetProfile = assetProfiles[
getAssetProfileIdentifier({
dataSource: SymbolProfile.dataSource,
symbol: SymbolProfile.symbol
})
] ?? {
currency: SymbolProfile.currency,
dataSource: SymbolProfile.dataSource,
symbol: SymbolProfile.symbol
};
const validatedAccount = accounts.find(({ id }) => { const validatedAccount = accounts.find(({ id }) => {
return id === accountId; return id === accountId;
}); });
@ -296,16 +306,10 @@ export class ImportService {
name: assetProfile.name, name: assetProfile.name,
scraperConfiguration: assetProfile.scraperConfiguration, scraperConfiguration: assetProfile.scraperConfiguration,
sectors: assetProfile.sectors, sectors: assetProfile.sectors,
symbol: assetProfile.currency, symbol: assetProfile.symbol,
symbolMapping: assetProfile.symbolMapping, symbolMapping: assetProfile.symbolMapping,
updatedAt: assetProfile.updatedAt, updatedAt: assetProfile.updatedAt,
url: assetProfile.url, url: assetProfile.url
...assetProfiles[
getAssetProfileIdentifier({
dataSource: assetProfile.dataSource,
symbol: assetProfile.symbol
})
]
}, },
Account: validatedAccount, Account: validatedAccount,
symbolProfileId: undefined, symbolProfileId: undefined,
@ -347,7 +351,6 @@ export class ImportService {
const value = new Big(quantity).mul(unitPrice).toNumber(); const value = new Big(quantity).mul(unitPrice).toNumber();
//@ts-ignore
activities.push({ activities.push({
...order, ...order,
error, error,
@ -357,6 +360,7 @@ export class ImportService {
assetProfile.currency, assetProfile.currency,
userCurrency userCurrency
), ),
//@ts-ignore
SymbolProfile: assetProfile, SymbolProfile: assetProfile,
valueInBaseCurrency: this.exchangeRateDataService.toCurrency( valueInBaseCurrency: this.exchangeRateDataService.toCurrency(
value, value,

Loading…
Cancel
Save