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
parent
commit
a5f934460b
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      apps/api/src/app/admin/admin.controller.ts
  2. 6
      apps/api/src/app/admin/admin.service.ts
  3. 8
      apps/client/src/app/components/admin-users/admin-users.component.ts
  4. 4
      apps/client/src/app/components/user-detail-dialog/interfaces/interfaces.ts
  5. 4
      apps/client/src/app/services/admin.service.ts
  6. 4
      libs/common/src/lib/interfaces/index.ts
  7. 2
      libs/common/src/lib/interfaces/responses/admin-users-response.interface.ts

4
apps/api/src/app/admin/admin.controller.ts

@ -17,7 +17,7 @@ import { getAssetProfileIdentifier } from '@ghostfolio/common/helper';
import { import {
AdminData, AdminData,
AdminMarketData, AdminMarketData,
AdminUsers, AdminUsersResponse,
EnhancedSymbolProfile, EnhancedSymbolProfile,
ScraperConfiguration ScraperConfiguration
} from '@ghostfolio/common/interfaces'; } from '@ghostfolio/common/interfaces';
@ -315,7 +315,7 @@ export class AdminController {
public async getUsers( public async getUsers(
@Query('skip') skip?: number, @Query('skip') skip?: number,
@Query('take') take?: number @Query('take') take?: number
): Promise<AdminUsers> { ): Promise<AdminUsersResponse> {
return this.adminService.getUsers({ return this.adminService.getUsers({
skip: isNaN(skip) ? undefined : skip, skip: isNaN(skip) ? undefined : skip,
take: isNaN(take) ? undefined : take take: isNaN(take) ? undefined : take

6
apps/api/src/app/admin/admin.service.ts

@ -23,7 +23,7 @@ import {
AdminMarketData, AdminMarketData,
AdminMarketDataDetails, AdminMarketDataDetails,
AdminMarketDataItem, AdminMarketDataItem,
AdminUsers, AdminUsersResponse,
AssetProfileIdentifier, AssetProfileIdentifier,
EnhancedSymbolProfile, EnhancedSymbolProfile,
Filter Filter
@ -513,7 +513,7 @@ export class AdminService {
}: { }: {
skip?: number; skip?: number;
take?: number; take?: number;
}): Promise<AdminUsers> { }): Promise<AdminUsersResponse> {
const [count, users] = await Promise.all([ const [count, users] = await Promise.all([
this.countUsersWithAnalytics(), this.countUsersWithAnalytics(),
this.getUsersWithAnalytics({ skip, take }) this.getUsersWithAnalytics({ skip, take })
@ -818,7 +818,7 @@ export class AdminService {
}: { }: {
skip?: number; skip?: number;
take?: number; take?: number;
}): Promise<AdminUsers['users']> { }): Promise<AdminUsersResponse['users']> {
let orderBy: Prisma.Enumerable<Prisma.UserOrderByWithRelationInput> = [ let orderBy: Prisma.Enumerable<Prisma.UserOrderByWithRelationInput> = [
{ createdAt: 'desc' } { createdAt: 'desc' }
]; ];

8
apps/client/src/app/components/admin-users/admin-users.component.ts

@ -5,7 +5,11 @@ import {
getDateFormatString, getDateFormatString,
getEmojiFlag getEmojiFlag
} from '@ghostfolio/common/helper'; } 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 { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator'; import { GfPremiumIndicatorComponent } from '@ghostfolio/ui/premium-indicator';
import { GfValueComponent } from '@ghostfolio/ui/value'; 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 { export class GfAdminUsersComponent implements OnDestroy, OnInit {
@ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatPaginator) paginator: MatPaginator;
public dataSource = new MatTableDataSource<AdminUsers['users'][0]>(); public dataSource = new MatTableDataSource<AdminUsersResponse['users'][0]>();
public defaultDateFormat: string; public defaultDateFormat: string;
public deviceType: string; public deviceType: string;
public displayedColumns: string[] = []; public displayedColumns: string[] = [];

4
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 { export interface UserDetailDialogParams {
deviceType: string; deviceType: string;
hasPermissionForSubscription: boolean; hasPermissionForSubscription: boolean;
locale: string; locale: string;
userData: AdminUsers['users'][0]; userData: AdminUsersResponse['users'][0];
} }

4
apps/client/src/app/services/admin.service.ts

@ -12,7 +12,7 @@ import {
AdminData, AdminData,
AdminJobs, AdminJobs,
AdminMarketData, AdminMarketData,
AdminUsers, AdminUsersResponse,
DataProviderGhostfolioStatusResponse, DataProviderGhostfolioStatusResponse,
EnhancedSymbolProfile, EnhancedSymbolProfile,
Filter Filter
@ -154,7 +154,7 @@ export class AdminService {
params = params.append('skip', skip); params = params.append('skip', skip);
params = params.append('take', take); 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() { public gather7Days() {

4
libs/common/src/lib/interfaces/index.ts

@ -7,7 +7,6 @@ import type {
AdminMarketData, AdminMarketData,
AdminMarketDataItem AdminMarketDataItem
} from './admin-market-data.interface'; } from './admin-market-data.interface';
import type { AdminUsers } from './admin-users.interface';
import type { AssetClassSelectorOption } from './asset-class-selector-option.interface'; import type { AssetClassSelectorOption } from './asset-class-selector-option.interface';
import type { AssetProfileIdentifier } from './asset-profile-identifier.interface'; import type { AssetProfileIdentifier } from './asset-profile-identifier.interface';
import type { BenchmarkProperty } from './benchmark-property.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 { AccountsResponse } from './responses/accounts-response.interface';
import type { ActivitiesResponse } from './responses/activities-response.interface'; import type { ActivitiesResponse } from './responses/activities-response.interface';
import type { ActivityResponse } from './responses/activity-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 { AiPromptResponse } from './responses/ai-prompt-response.interface';
import type { ApiKeyResponse } from './responses/api-key-response.interface'; import type { ApiKeyResponse } from './responses/api-key-response.interface';
import type { AssetResponse } from './responses/asset-response.interface'; import type { AssetResponse } from './responses/asset-response.interface';
@ -92,7 +92,7 @@ export {
AdminMarketData, AdminMarketData,
AdminMarketDataDetails, AdminMarketDataDetails,
AdminMarketDataItem, AdminMarketDataItem,
AdminUsers, AdminUsersResponse,
AiPromptResponse, AiPromptResponse,
ApiKeyResponse, ApiKeyResponse,
AssetClassSelectorOption, AssetClassSelectorOption,

2
libs/common/src/lib/interfaces/admin-users.interface.ts → libs/common/src/lib/interfaces/responses/admin-users-response.interface.ts

@ -1,6 +1,6 @@
import { Role } from '@prisma/client'; import { Role } from '@prisma/client';
export interface AdminUsers { export interface AdminUsersResponse {
count: number; count: number;
users: { users: {
accountCount: number; accountCount: number;
Loading…
Cancel
Save