|
@ -1,8 +1,12 @@ |
|
|
import { PortfolioService } from '@ghostfolio/api/app/portfolio/portfolio.service'; |
|
|
import { PortfolioService } from '@ghostfolio/api/app/portfolio/portfolio.service'; |
|
|
import { RedactValuesInResponseInterceptor } from '@ghostfolio/api/interceptors/redact-values-in-response.interceptor'; |
|
|
import { RedactValuesInResponseInterceptor } from '@ghostfolio/api/interceptors/redact-values-in-response.interceptor'; |
|
|
|
|
|
import { AccountBalanceService } from '@ghostfolio/api/services/account-balance/account-balance.service'; |
|
|
import { ImpersonationService } from '@ghostfolio/api/services/impersonation/impersonation.service'; |
|
|
import { ImpersonationService } from '@ghostfolio/api/services/impersonation/impersonation.service'; |
|
|
import { HEADER_KEY_IMPERSONATION } from '@ghostfolio/common/config'; |
|
|
import { HEADER_KEY_IMPERSONATION } from '@ghostfolio/common/config'; |
|
|
import { Accounts } from '@ghostfolio/common/interfaces'; |
|
|
import { |
|
|
|
|
|
AccountBalancesResponse, |
|
|
|
|
|
Accounts |
|
|
|
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions'; |
|
|
import { hasPermission, permissions } from '@ghostfolio/common/permissions'; |
|
|
import type { |
|
|
import type { |
|
|
AccountWithValue, |
|
|
AccountWithValue, |
|
@ -35,6 +39,7 @@ import { UpdateAccountDto } from './update-account.dto'; |
|
|
@Controller('account') |
|
|
@Controller('account') |
|
|
export class AccountController { |
|
|
export class AccountController { |
|
|
public constructor( |
|
|
public constructor( |
|
|
|
|
|
private readonly accountBalanceService: AccountBalanceService, |
|
|
private readonly accountService: AccountService, |
|
|
private readonly accountService: AccountService, |
|
|
private readonly impersonationService: ImpersonationService, |
|
|
private readonly impersonationService: ImpersonationService, |
|
|
private readonly portfolioService: PortfolioService, |
|
|
private readonly portfolioService: PortfolioService, |
|
@ -116,6 +121,18 @@ export class AccountController { |
|
|
return accountsWithAggregations.accounts[0]; |
|
|
return accountsWithAggregations.accounts[0]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Get(':id/balances') |
|
|
|
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
|
|
|
@UseInterceptors(RedactValuesInResponseInterceptor) |
|
|
|
|
|
public async getAccountBalancesById( |
|
|
|
|
|
@Param('id') id: string |
|
|
|
|
|
): Promise<AccountBalancesResponse> { |
|
|
|
|
|
return this.accountBalanceService.getAccountBalances({ |
|
|
|
|
|
accountId: id, |
|
|
|
|
|
userId: this.request.user.id |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Post() |
|
|
@Post() |
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
@UseGuards(AuthGuard('jwt')) |
|
|
public async createAccount( |
|
|
public async createAccount( |
|
|