From a5f934460bc4a79d5eaeb9a912b917a4743e7b5f Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 2 Nov 2025 19:51:27 +0100 Subject: [PATCH] Task/introduce interface for get admin users response (#5903) * Introduce interface for get admin users response --- apps/api/src/app/admin/admin.controller.ts | 4 ++-- apps/api/src/app/admin/admin.service.ts | 6 +++--- .../app/components/admin-users/admin-users.component.ts | 8 ++++++-- .../user-detail-dialog/interfaces/interfaces.ts | 4 ++-- apps/client/src/app/services/admin.service.ts | 4 ++-- libs/common/src/lib/interfaces/index.ts | 4 ++-- .../admin-users-response.interface.ts} | 2 +- 7 files changed, 18 insertions(+), 14 deletions(-) rename libs/common/src/lib/interfaces/{admin-users.interface.ts => responses/admin-users-response.interface.ts} (88%) diff --git a/apps/api/src/app/admin/admin.controller.ts b/apps/api/src/app/admin/admin.controller.ts index d7c4c5d3d..2419b0a7d 100644 --- a/apps/api/src/app/admin/admin.controller.ts +++ b/apps/api/src/app/admin/admin.controller.ts @@ -17,7 +17,7 @@ import { getAssetProfileIdentifier } from '@ghostfolio/common/helper'; import { AdminData, AdminMarketData, - AdminUsers, + AdminUsersResponse, EnhancedSymbolProfile, ScraperConfiguration } from '@ghostfolio/common/interfaces'; @@ -315,7 +315,7 @@ export class AdminController { public async getUsers( @Query('skip') skip?: number, @Query('take') take?: number - ): Promise { + ): Promise { return this.adminService.getUsers({ skip: isNaN(skip) ? undefined : skip, take: isNaN(take) ? undefined : take diff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.ts index 11f6f0599..683e72cb8 100644 --- a/apps/api/src/app/admin/admin.service.ts +++ b/apps/api/src/app/admin/admin.service.ts @@ -23,7 +23,7 @@ import { AdminMarketData, AdminMarketDataDetails, AdminMarketDataItem, - AdminUsers, + AdminUsersResponse, AssetProfileIdentifier, EnhancedSymbolProfile, Filter @@ -513,7 +513,7 @@ export class AdminService { }: { skip?: number; take?: number; - }): Promise { + }): Promise { const [count, users] = await Promise.all([ this.countUsersWithAnalytics(), this.getUsersWithAnalytics({ skip, take }) @@ -818,7 +818,7 @@ export class AdminService { }: { skip?: number; take?: number; - }): Promise { + }): Promise { let orderBy: Prisma.Enumerable = [ { createdAt: 'desc' } ]; diff --git a/apps/client/src/app/components/admin-users/admin-users.component.ts b/apps/client/src/app/components/admin-users/admin-users.component.ts index c0d058ad2..94b5839c6 100644 --- a/apps/client/src/app/components/admin-users/admin-users.component.ts +++ b/apps/client/src/app/components/admin-users/admin-users.component.ts @@ -5,7 +5,11 @@ import { getDateFormatString, getEmojiFlag } from '@ghostfolio/common/helper'; -import { AdminUsers, InfoItem, User } from '@ghostfolio/common/interfaces'; +import { + AdminUsersResponse, + InfoItem, + User +} from '@ghostfolio/common/interfaces'; import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator'; import { GfValueComponent } from '@ghostfolio/ui/value'; @@ -75,7 +79,7 @@ import { GfUserDetailDialogComponent } from '../user-detail-dialog/user-detail-d export class GfAdminUsersComponent implements OnDestroy, OnInit { @ViewChild(MatPaginator) paginator: MatPaginator; - public dataSource = new MatTableDataSource(); + public dataSource = new MatTableDataSource(); public defaultDateFormat: string; public deviceType: string; public displayedColumns: string[] = []; diff --git a/apps/client/src/app/components/user-detail-dialog/interfaces/interfaces.ts b/apps/client/src/app/components/user-detail-dialog/interfaces/interfaces.ts index 5f3f4b87a..d29bc01bc 100644 --- a/apps/client/src/app/components/user-detail-dialog/interfaces/interfaces.ts +++ b/apps/client/src/app/components/user-detail-dialog/interfaces/interfaces.ts @@ -1,8 +1,8 @@ -import { AdminUsers } from '@ghostfolio/common/interfaces'; +import { AdminUsersResponse } from '@ghostfolio/common/interfaces'; export interface UserDetailDialogParams { deviceType: string; hasPermissionForSubscription: boolean; locale: string; - userData: AdminUsers['users'][0]; + userData: AdminUsersResponse['users'][0]; } diff --git a/apps/client/src/app/services/admin.service.ts b/apps/client/src/app/services/admin.service.ts index a04ad8d56..2f3040ba3 100644 --- a/apps/client/src/app/services/admin.service.ts +++ b/apps/client/src/app/services/admin.service.ts @@ -12,7 +12,7 @@ import { AdminData, AdminJobs, AdminMarketData, - AdminUsers, + AdminUsersResponse, DataProviderGhostfolioStatusResponse, EnhancedSymbolProfile, Filter @@ -154,7 +154,7 @@ export class AdminService { params = params.append('skip', skip); params = params.append('take', take); - return this.http.get('/api/v1/admin/user', { params }); + return this.http.get('/api/v1/admin/user', { params }); } public gather7Days() { diff --git a/libs/common/src/lib/interfaces/index.ts b/libs/common/src/lib/interfaces/index.ts index eac5db68c..06ecf32e8 100644 --- a/libs/common/src/lib/interfaces/index.ts +++ b/libs/common/src/lib/interfaces/index.ts @@ -7,7 +7,6 @@ import type { AdminMarketData, AdminMarketDataItem } from './admin-market-data.interface'; -import type { AdminUsers } from './admin-users.interface'; import type { AssetClassSelectorOption } from './asset-class-selector-option.interface'; import type { AssetProfileIdentifier } from './asset-profile-identifier.interface'; import type { BenchmarkProperty } from './benchmark-property.interface'; @@ -39,6 +38,7 @@ import type { AccountBalancesResponse } from './responses/account-balances-respo import type { AccountsResponse } from './responses/accounts-response.interface'; import type { ActivitiesResponse } from './responses/activities-response.interface'; import type { ActivityResponse } from './responses/activity-response.interface'; +import type { AdminUsersResponse } from './responses/admin-users-response.interface'; import type { AiPromptResponse } from './responses/ai-prompt-response.interface'; import type { ApiKeyResponse } from './responses/api-key-response.interface'; import type { AssetResponse } from './responses/asset-response.interface'; @@ -92,7 +92,7 @@ export { AdminMarketData, AdminMarketDataDetails, AdminMarketDataItem, - AdminUsers, + AdminUsersResponse, AiPromptResponse, ApiKeyResponse, AssetClassSelectorOption, diff --git a/libs/common/src/lib/interfaces/admin-users.interface.ts b/libs/common/src/lib/interfaces/responses/admin-users-response.interface.ts similarity index 88% rename from libs/common/src/lib/interfaces/admin-users.interface.ts rename to libs/common/src/lib/interfaces/responses/admin-users-response.interface.ts index 79031425a..d9f58ee18 100644 --- a/libs/common/src/lib/interfaces/admin-users.interface.ts +++ b/libs/common/src/lib/interfaces/responses/admin-users-response.interface.ts @@ -1,6 +1,6 @@ import { Role } from '@prisma/client'; -export interface AdminUsers { +export interface AdminUsersResponse { count: number; users: { accountCount: number;