Browse Source

Task/introduce interface for get account response (#5902)

* Introduce interface for get account response
pull/5928/head
Thomas Kaul 3 weeks ago
committed by GitHub
parent
commit
9383fc00cb
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      apps/api/src/app/account/account.controller.ts
  2. 4
      apps/client/src/app/services/data.service.ts
  3. 2
      libs/common/src/lib/interfaces/index.ts
  4. 3
      libs/common/src/lib/interfaces/responses/account-response.interface.ts

8
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<AccountWithValue> {
): Promise<AccountResponse> {
const impersonationUserId =
await this.impersonationService.validateImpersonationId(impersonationId);

4
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<AccountWithValue>(`/api/v1/account/${aAccountId}`);
return this.http.get<AccountResponse>(`/api/v1/account/${aAccountId}`);
}
public fetchAccountBalances(aAccountId: string) {

2
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,

3
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 {}
Loading…
Cancel
Save