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 {
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

6
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<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' }
];

8
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<AdminUsers['users'][0]>();
public dataSource = new MatTableDataSource<AdminUsersResponse['users'][0]>();
public defaultDateFormat: string;
public deviceType: 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 {
deviceType: string;
hasPermissionForSubscription: boolean;
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,
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() {

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

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';
export interface AdminUsers {
export interface AdminUsersResponse {
count: number;
users: {
accountCount: number;
Loading…
Cancel
Save