|
|
@ -165,6 +165,10 @@ export class PortfolioService { |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const filtersWithoutSearchQueryFilter = filters?.filter(({ type }) => { |
|
|
|
|
|
return type !== 'SEARCH_QUERY'; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
const [accounts, details, user] = await Promise.all([ |
|
|
const [accounts, details, user] = await Promise.all([ |
|
|
this.accountService.accounts({ |
|
|
this.accountService.accounts({ |
|
|
where, |
|
|
where, |
|
|
@ -176,8 +180,8 @@ export class PortfolioService { |
|
|
orderBy: { name: 'asc' } |
|
|
orderBy: { name: 'asc' } |
|
|
}), |
|
|
}), |
|
|
this.getDetails({ |
|
|
this.getDetails({ |
|
|
filters, |
|
|
|
|
|
withExcludedAccounts, |
|
|
withExcludedAccounts, |
|
|
|
|
|
filters: filtersWithoutSearchQueryFilter, |
|
|
impersonationId: userId, |
|
|
impersonationId: userId, |
|
|
userId: this.request.user.id |
|
|
userId: this.request.user.id |
|
|
}), |
|
|
}), |
|
|
@ -369,14 +373,6 @@ export class PortfolioService { |
|
|
userId: string; |
|
|
userId: string; |
|
|
}) { |
|
|
}) { |
|
|
userId = await this.getUserId(impersonationId, userId); |
|
|
userId = await this.getUserId(impersonationId, userId); |
|
|
const { holdings: holdingsMap } = await this.getDetails({ |
|
|
|
|
|
dateRange, |
|
|
|
|
|
filters, |
|
|
|
|
|
impersonationId, |
|
|
|
|
|
userId |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
let holdings = Object.values(holdingsMap); |
|
|
|
|
|
|
|
|
|
|
|
const { SEARCH_QUERY: [filterBySearchQuery] = [] } = groupBy( |
|
|
const { SEARCH_QUERY: [filterBySearchQuery] = [] } = groupBy( |
|
|
filters, |
|
|
filters, |
|
|
@ -385,9 +381,22 @@ export class PortfolioService { |
|
|
} |
|
|
} |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const filtersWithoutSearchQueryFilter = filters?.filter(({ type }) => { |
|
|
|
|
|
return type !== 'SEARCH_QUERY'; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const { holdings: holdingsMap } = await this.getDetails({ |
|
|
|
|
|
dateRange, |
|
|
|
|
|
impersonationId, |
|
|
|
|
|
userId, |
|
|
|
|
|
filters: filtersWithoutSearchQueryFilter |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
let holdings = Object.values(holdingsMap); |
|
|
|
|
|
|
|
|
if (filterBySearchQuery) { |
|
|
if (filterBySearchQuery) { |
|
|
const fuse = new Fuse(holdings, { |
|
|
const fuse = new Fuse(holdings, { |
|
|
keys: ['isin', 'name', 'symbol'], |
|
|
keys: ['assetProfile.isin', 'assetProfile.name', 'assetProfile.symbol'], |
|
|
threshold: 0.3 |
|
|
threshold: 0.3 |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
@ -651,6 +660,7 @@ export class PortfolioService { |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
), |
|
|
), |
|
|
|
|
|
isin: assetProfile.isin, |
|
|
name: assetProfile.name, |
|
|
name: assetProfile.name, |
|
|
sectors: assetProfile.sectors, |
|
|
sectors: assetProfile.sectors, |
|
|
symbol: assetProfile.symbol, |
|
|
symbol: assetProfile.symbol, |
|
|
|