Browse Source
Task/introduce interface for get admin users response (#5903)
* Introduce interface for get admin users response
pull/5843/head
Thomas Kaul
4 weeks ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with
18 additions and
14 deletions
-
apps/api/src/app/admin/admin.controller.ts
-
apps/api/src/app/admin/admin.service.ts
-
apps/client/src/app/components/admin-users/admin-users.component.ts
-
apps/client/src/app/components/user-detail-dialog/interfaces/interfaces.ts
-
apps/client/src/app/services/admin.service.ts
-
libs/common/src/lib/interfaces/index.ts
-
libs/common/src/lib/interfaces/responses/admin-users-response.interface.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<AdminUsers> { |
|
|
|
): Promise<AdminUsersResponse> { |
|
|
|
return this.adminService.getUsers({ |
|
|
|
skip: isNaN(skip) ? undefined : skip, |
|
|
|
take: isNaN(take) ? undefined : take |
|
|
|
|
|
|
|
@ -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<AdminUsers> { |
|
|
|
}): Promise<AdminUsersResponse> { |
|
|
|
const [count, users] = await Promise.all([ |
|
|
|
this.countUsersWithAnalytics(), |
|
|
|
this.getUsersWithAnalytics({ skip, take }) |
|
|
|
@ -818,7 +818,7 @@ export class AdminService { |
|
|
|
}: { |
|
|
|
skip?: number; |
|
|
|
take?: number; |
|
|
|
}): Promise<AdminUsers['users']> { |
|
|
|
}): Promise<AdminUsersResponse['users']> { |
|
|
|
let orderBy: Prisma.Enumerable<Prisma.UserOrderByWithRelationInput> = [ |
|
|
|
{ createdAt: 'desc' } |
|
|
|
]; |
|
|
|
|
|
|
|
@ -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<AdminUsers['users'][0]>(); |
|
|
|
public dataSource = new MatTableDataSource<AdminUsersResponse['users'][0]>(); |
|
|
|
public defaultDateFormat: string; |
|
|
|
public deviceType: string; |
|
|
|
public displayedColumns: string[] = []; |
|
|
|
|
|
|
|
@ -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]; |
|
|
|
} |
|
|
|
|
|
|
|
@ -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<AdminUsers>('/api/v1/admin/user', { params }); |
|
|
|
return this.http.get<AdminUsersResponse>('/api/v1/admin/user', { params }); |
|
|
|
} |
|
|
|
|
|
|
|
public gather7Days() { |
|
|
|
|
|
|
|
@ -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, |
|
|
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
import { Role } from '@prisma/client'; |
|
|
|
|
|
|
|
export interface AdminUsers { |
|
|
|
export interface AdminUsersResponse { |
|
|
|
count: number; |
|
|
|
users: { |
|
|
|
accountCount: number; |