Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/add impersonation mode in get account balances endpoint (#6272)
Thomas Kaul9c4638c185d4
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 371a8e6f4c..f3bdf396b7 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -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`### Changeddiff --git a/apps/api/src/app/account/account.controller.ts b/apps/api/src/app/account/account.controller.tsindex 542b199fd4..0527201767 100644--- a/apps/api/src/app/account/account.controller.ts+++ b/apps/api/src/app/account/account.controller.ts@@ -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});}