Browse Source

Task/remove symbol profile from import preview (#8023)

Remove symbol profile from import preview
pull/8038/head
Thomas Kaul 1 week ago
committed by GitHub
parent
commit
3476d9e418
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 61
      apps/api/src/app/import/import.service.ts

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

@ -857,28 +857,6 @@ export class ImportService {
dataSource: activity.assetProfile.dataSource,
symbol: activity.assetProfile.symbol
};
const {
assetClass,
assetSubClass,
countries,
createdAt,
cusip,
dataSource,
figi,
figiComposite,
figiShareClass,
holdings,
id,
isActive,
isin,
name,
scraperConfiguration,
sectors,
symbol,
symbolMapping,
url,
updatedAt
} = assetProfile;
const validatedAccount = accounts.find(({ id }) => {
return id === accountId;
});
@ -890,7 +868,7 @@ export class ImportService {
let order:
| OrderWithAccount
| (Omit<OrderWithAccount, 'account' | 'tags'> & {
| (Omit<OrderWithAccount, 'account' | 'SymbolProfile' | 'tags'> & {
account?: { id: string; name: string };
tags?: { id: string; name: string }[];
});
@ -916,33 +894,6 @@ export class ImportService {
accountUserId: undefined,
createdAt: new Date(),
id: randomUUID(),
SymbolProfile: {
assetClass,
assetSubClass,
countries,
createdAt,
cusip,
dataSource,
figi,
figiComposite,
figiShareClass,
holdings,
id,
isActive,
isin,
name,
scraperConfiguration,
sectors,
symbol,
symbolMapping,
updatedAt,
url,
comment: assetProfile.comment,
currency: assetProfile.currency,
dataGatheringFrequency:
assetProfile.dataGatheringFrequency ?? 'DAILY',
userId: dataSource === 'MANUAL' ? user.id : undefined
},
symbolProfileId: undefined,
tags: previewTags,
updatedAt: new Date(),
@ -953,7 +904,9 @@ export class ImportService {
continue;
}
order = await this.activitiesService.createActivity({
const { dataSource, name, symbol } = assetProfile;
const createdActivity = await this.activitiesService.createActivity({
comment,
currency,
date,
@ -987,10 +940,12 @@ export class ImportService {
userId: user.id
});
if (order.SymbolProfile?.symbol) {
if (createdActivity.SymbolProfile?.symbol) {
// Update symbol that may have been assigned in createOrder()
assetProfile.symbol = order.SymbolProfile.symbol;
assetProfile.symbol = createdActivity.SymbolProfile.symbol;
}
order = createdActivity;
}
const value = new Big(quantity).mul(unitPrice).toNumber();

Loading…
Cancel
Save