From 9383fc00cb61482e162df7fa6dcfcdbe32626b23 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 9 Nov 2025 07:44:53 +0100 Subject: [PATCH] Task/introduce interface for get account response (#5902) * Introduce interface for get account response --- apps/api/src/app/account/account.controller.ts | 8 +++----- apps/client/src/app/services/data.service.ts | 4 ++-- libs/common/src/lib/interfaces/index.ts | 2 ++ .../interfaces/responses/account-response.interface.ts | 3 +++ 4 files changed, 10 insertions(+), 7 deletions(-) create mode 100644 libs/common/src/lib/interfaces/responses/account-response.interface.ts diff --git a/apps/api/src/app/account/account.controller.ts b/apps/api/src/app/account/account.controller.ts index 7b24ccdcb..cd6892ab8 100644 --- a/apps/api/src/app/account/account.controller.ts +++ b/apps/api/src/app/account/account.controller.ts @@ -9,13 +9,11 @@ import { ImpersonationService } from '@ghostfolio/api/services/impersonation/imp import { HEADER_KEY_IMPERSONATION } from '@ghostfolio/common/config'; import { AccountBalancesResponse, + AccountResponse, AccountsResponse } from '@ghostfolio/common/interfaces'; import { permissions } from '@ghostfolio/common/permissions'; -import type { - AccountWithValue, - RequestWithUser -} from '@ghostfolio/common/types'; +import type { RequestWithUser } from '@ghostfolio/common/types'; import { Body, @@ -114,7 +112,7 @@ export class AccountController { public async getAccountById( @Headers(HEADER_KEY_IMPERSONATION.toLowerCase()) impersonationId: string, @Param('id') id: string - ): Promise { + ): Promise { const impersonationUserId = await this.impersonationService.validateImpersonationId(impersonationId); diff --git a/apps/client/src/app/services/data.service.ts b/apps/client/src/app/services/data.service.ts index 6f0b17ed1..f83746009 100644 --- a/apps/client/src/app/services/data.service.ts +++ b/apps/client/src/app/services/data.service.ts @@ -22,6 +22,7 @@ import { Access, AccessTokenResponse, AccountBalancesResponse, + AccountResponse, AccountsResponse, ActivitiesResponse, ActivityResponse, @@ -54,7 +55,6 @@ import { } from '@ghostfolio/common/interfaces'; import { filterGlobalPermissions } from '@ghostfolio/common/permissions'; import type { - AccountWithValue, AiPromptMode, DateRange, GroupBy @@ -186,7 +186,7 @@ export class DataService { } public fetchAccount(aAccountId: string) { - return this.http.get(`/api/v1/account/${aAccountId}`); + return this.http.get(`/api/v1/account/${aAccountId}`); } public fetchAccountBalances(aAccountId: string) { diff --git a/libs/common/src/lib/interfaces/index.ts b/libs/common/src/lib/interfaces/index.ts index 899813f30..5c516a4a6 100644 --- a/libs/common/src/lib/interfaces/index.ts +++ b/libs/common/src/lib/interfaces/index.ts @@ -36,6 +36,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 { AccountResponse } from './responses/account-response.interface'; import type { AccountsResponse } from './responses/accounts-response.interface'; import type { ActivitiesResponse } from './responses/activities-response.interface'; import type { ActivityResponse } from './responses/activity-response.interface'; @@ -86,6 +87,7 @@ export { AccessTokenResponse, AccountBalance, AccountBalancesResponse, + AccountResponse, AccountsResponse, ActivitiesResponse, ActivityResponse, diff --git a/libs/common/src/lib/interfaces/responses/account-response.interface.ts b/libs/common/src/lib/interfaces/responses/account-response.interface.ts new file mode 100644 index 000000000..3e954dc72 --- /dev/null +++ b/libs/common/src/lib/interfaces/responses/account-response.interface.ts @@ -0,0 +1,3 @@ +import { AccountWithValue } from '@ghostfolio/common/types'; + +export interface AccountResponse extends AccountWithValue {}