Browse Source
Feature/refactor accounts response interface (#4644)
* Refactor accounts response interface
main
Thomas Kaul
21 hours ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with
9 additions and
9 deletions
-
apps/api/src/app/account/account.controller.ts
-
apps/api/src/app/portfolio/portfolio.service.ts
-
apps/client/src/app/services/data.service.ts
-
libs/common/src/lib/interfaces/index.ts
-
libs/common/src/lib/interfaces/responses/accounts-response.interface.ts
|
|
@ -9,7 +9,7 @@ import { ImpersonationService } from '@ghostfolio/api/services/impersonation/imp |
|
|
|
import { HEADER_KEY_IMPERSONATION } from '@ghostfolio/common/config'; |
|
|
|
import { |
|
|
|
AccountBalancesResponse, |
|
|
|
Accounts |
|
|
|
AccountsResponse |
|
|
|
} from '@ghostfolio/common/interfaces'; |
|
|
|
import { permissions } from '@ghostfolio/common/permissions'; |
|
|
|
import type { |
|
|
@ -90,7 +90,7 @@ export class AccountController { |
|
|
|
@Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId, |
|
|
|
@Query('dataSource') filterByDataSource?: string, |
|
|
|
@Query('symbol') filterBySymbol?: string |
|
|
|
): Promise<Accounts> { |
|
|
|
): Promise<AccountsResponse> { |
|
|
|
const impersonationUserId = |
|
|
|
await this.impersonationService.validateImpersonationId(impersonationId); |
|
|
|
|
|
|
|
|
|
@ -35,7 +35,7 @@ import { |
|
|
|
} from '@ghostfolio/common/config'; |
|
|
|
import { DATE_FORMAT, getSum, parseDate } from '@ghostfolio/common/helper'; |
|
|
|
import { |
|
|
|
Accounts, |
|
|
|
AccountsResponse, |
|
|
|
EnhancedSymbolProfile, |
|
|
|
Filter, |
|
|
|
HistoricalDataItem, |
|
|
@ -209,7 +209,7 @@ export class PortfolioService { |
|
|
|
filters?: Filter[]; |
|
|
|
userId: string; |
|
|
|
withExcludedAccounts?: boolean; |
|
|
|
}): Promise<Accounts> { |
|
|
|
}): Promise<AccountsResponse> { |
|
|
|
const accounts = await this.getAccounts({ |
|
|
|
filters, |
|
|
|
userId, |
|
|
|
|
|
@ -25,7 +25,7 @@ import { |
|
|
|
Access, |
|
|
|
AccessTokenResponse, |
|
|
|
AccountBalancesResponse, |
|
|
|
Accounts, |
|
|
|
AccountsResponse, |
|
|
|
AiPromptResponse, |
|
|
|
ApiKeyResponse, |
|
|
|
AssetProfileIdentifier, |
|
|
@ -191,7 +191,7 @@ export class DataService { |
|
|
|
public fetchAccounts({ filters }: { filters?: Filter[] } = {}) { |
|
|
|
const params = this.buildFiltersAsQueryParams({ filters }); |
|
|
|
|
|
|
|
return this.http.get<Accounts>('/api/v1/account', { params }); |
|
|
|
return this.http.get<AccountsResponse>('/api/v1/account', { params }); |
|
|
|
} |
|
|
|
|
|
|
|
public fetchActivities({ |
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
import type { Access } from './access.interface'; |
|
|
|
import type { AccountBalance } from './account-balance.interface'; |
|
|
|
import type { Accounts } from './accounts.interface'; |
|
|
|
import type { AdminData } from './admin-data.interface'; |
|
|
|
import type { AdminJobs } from './admin-jobs.interface'; |
|
|
|
import type { AdminMarketDataDetails } from './admin-market-data-details.interface'; |
|
|
@ -40,6 +39,7 @@ import type { Position } from './position.interface'; |
|
|
|
import type { Product } from './product'; |
|
|
|
import type { AccessTokenResponse } from './responses/access-token-response.interface'; |
|
|
|
import type { AccountBalancesResponse } from './responses/account-balances-response.interface'; |
|
|
|
import type { AccountsResponse } from './responses/accounts-response.interface'; |
|
|
|
import type { AiPromptResponse } from './responses/ai-prompt-response.interface'; |
|
|
|
import type { ApiKeyResponse } from './responses/api-key-response.interface'; |
|
|
|
import type { BenchmarkResponse } from './responses/benchmark-response.interface'; |
|
|
@ -74,7 +74,7 @@ export { |
|
|
|
AccessTokenResponse, |
|
|
|
AccountBalance, |
|
|
|
AccountBalancesResponse, |
|
|
|
Accounts, |
|
|
|
AccountsResponse, |
|
|
|
AdminData, |
|
|
|
AdminJobs, |
|
|
|
AdminMarketData, |
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
import { AccountWithValue } from '@ghostfolio/common/types'; |
|
|
|
|
|
|
|
export interface Accounts { |
|
|
|
export interface AccountsResponse { |
|
|
|
accounts: AccountWithValue[]; |
|
|
|
totalBalanceInBaseCurrency: number; |
|
|
|
totalValueInBaseCurrency: number; |