Browse Source

Merge branch 'main' into feature/add-filter-by-data-source-for-asset-profiles-in-admin-control-panel

pull/5385/head
Thomas Kaul 17 hours ago
committed by GitHub
parent
commit
7fbadb5e69
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 2
      apps/api/src/app/admin/admin.controller.ts
  3. 46
      apps/api/src/app/admin/admin.service.ts

1
CHANGELOG.md

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added a filter by data source for the asset profiles in the admin control panel
- Extended the data providers management of the admin control panel by every data provider in use
## 2.192.0 - 2025-08-21

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

@ -66,7 +66,7 @@ export class AdminController {
@HasPermission(permissions.accessAdminControl)
@UseGuards(AuthGuard('jwt'), HasPermissionGuard)
public async getAdminData(): Promise<AdminData> {
return this.adminService.get({ user: this.request.user });
return this.adminService.get();
}
@Get('demo-user/sync')

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

@ -29,7 +29,7 @@ import {
Filter
} from '@ghostfolio/common/interfaces';
import { Sector } from '@ghostfolio/common/interfaces/sector.interface';
import { MarketDataPreset, UserWithSettings } from '@ghostfolio/common/types';
import { MarketDataPreset } from '@ghostfolio/common/types';
import {
BadRequestException,
@ -133,11 +133,8 @@ export class AdminService {
}
}
public async get({ user }: { user: UserWithSettings }): Promise<AdminData> {
const dataSources = await this.dataProviderService.getDataSources({
user,
includeGhostfolio: true
});
public async get(): Promise<AdminData> {
const dataSources = Object.values(DataSource);
const [settings, transactionCount, userCount] = await Promise.all([
this.propertyService.get(),
@ -145,24 +142,31 @@ export class AdminService {
this.countUsersWithAnalytics()
]);
const dataProviders = await Promise.all(
dataSources.map(async (dataSource) => {
const dataProviderInfo = this.dataProviderService
.getDataProvider(dataSource)
.getDataProviderInfo();
const dataProviders = (
await Promise.all(
dataSources.map(async (dataSource) => {
const assetProfileCount =
await this.prismaService.symbolProfile.count({
where: {
dataSource
}
});
const assetProfileCount = await this.prismaService.symbolProfile.count({
where: {
dataSource
if (assetProfileCount > 0 || dataSource === 'GHOSTFOLIO') {
const dataProviderInfo = this.dataProviderService
.getDataProvider(dataSource)
.getDataProviderInfo();
return {
...dataProviderInfo,
assetProfileCount
};
}
});
return {
...dataProviderInfo,
assetProfileCount
};
})
);
return null;
})
)
).filter(Boolean);
return {
dataProviders,

Loading…
Cancel
Save