Browse Source
Feature/add impersonation mode in get account balances endpoint (#6272)
* Add impersonation mode
* Update changelog
pull/6269/head
Thomas Kaul
6 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
6 additions and
1 deletions
-
CHANGELOG.md
-
apps/api/src/app/account/account.controller.ts
|
|
|
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
### Added |
|
|
|
|
|
|
|
- Added the ability to fetch top holdings for ETF and mutual fund assets from _Yahoo Finance_ |
|
|
|
- Added support for the impersonation mode in the endpoint `GET api/v1/account/:id/balances` |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
|
|
|
|
@ -132,12 +132,16 @@ export class AccountController { |
|
|
|
@UseGuards(AuthGuard('jwt'), HasPermissionGuard) |
|
|
|
@UseInterceptors(RedactValuesInResponseInterceptor) |
|
|
|
public async getAccountBalancesById( |
|
|
|
@Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string, |
|
|
|
@Param('id') id: string |
|
|
|
): Promise<AccountBalancesResponse> { |
|
|
|
const impersonationUserId = |
|
|
|
await this.impersonationService.validateImpersonationId(impersonationId); |
|
|
|
|
|
|
|
return this.accountBalanceService.getAccountBalances({ |
|
|
|
filters: [{ id, type: 'ACCOUNT' }], |
|
|
|
userCurrency: this.request.user.settings.settings.baseCurrency, |
|
|
|
userId: this.request.user.id |
|
|
|
userId: impersonationUserId || this.request.user.id |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|