Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/extend data providers management by every data provider in use (#5386)

Thomas Kaul21d337525dc4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6b496df2c2..196fb18533 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## Unreleased
+
+### Added
+
+- Extended the data providers management of the admin control panel by every data provider in use
+
## 2.192.0 - 2025-08-21
### Added
diff --git a/apps/api/src/app/admin/admin.controller.ts b/apps/api/src/app/admin/admin.controller.ts
index 8b2118ab19..e473813e99 100644
--- a/apps/api/src/app/admin/admin.controller.ts
+++ b/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')
diff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.ts
index 9e645c0594..bce6032899 100644
--- a/apps/api/src/app/admin/admin.service.ts
+++ b/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,