From dad3c27ad976efab5a24bcdaa30d0a6735dba987 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 23 Aug 2025 20:32:28 +0200 Subject: [PATCH] Feature/remove DATA_SOURCES_LEGACY (#5396) * Remove DATA_SOURCES_LEGACY --- apps/api/src/app/import/import.service.ts | 2 +- .../configuration/configuration.service.ts | 3 --- .../data-provider/data-provider.service.ts | 27 ++++--------------- .../interfaces/environment.interface.ts | 1 - 4 files changed, 6 insertions(+), 27 deletions(-) diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.ts index a9fe898b9..a96200261 100644 --- a/apps/api/src/app/import/import.service.ts +++ b/apps/api/src/app/import/import.service.ts @@ -712,7 +712,7 @@ export class ImportService { const assetProfiles: { [assetProfileIdentifier: string]: Partial; } = {}; - const dataSources = await this.dataProviderService.getDataSources({ user }); + const dataSources = await this.dataProviderService.getDataSources(); for (const [ index, diff --git a/apps/api/src/services/configuration/configuration.service.ts b/apps/api/src/services/configuration/configuration.service.ts index 602ad5e9c..473d909ee 100644 --- a/apps/api/src/services/configuration/configuration.service.ts +++ b/apps/api/src/services/configuration/configuration.service.ts @@ -40,9 +40,6 @@ export class ConfigurationService { DATA_SOURCES_GHOSTFOLIO_DATA_PROVIDER: json({ default: [] }), - DATA_SOURCES_LEGACY: json({ - default: [] - }), ENABLE_FEATURE_FEAR_AND_GREED_INDEX: bool({ default: false }), ENABLE_FEATURE_READ_ONLY_MODE: bool({ default: false }), ENABLE_FEATURE_SOCIAL_LOGIN: bool({ default: false }), diff --git a/apps/api/src/services/data-provider/data-provider.service.ts b/apps/api/src/services/data-provider/data-provider.service.ts index 674672326..631f90d63 100644 --- a/apps/api/src/services/data-provider/data-provider.service.ts +++ b/apps/api/src/services/data-provider/data-provider.service.ts @@ -26,13 +26,12 @@ import { LookupItem, LookupResponse } from '@ghostfolio/common/interfaces'; -import { hasRole } from '@ghostfolio/common/permissions'; import type { Granularity, UserWithSettings } from '@ghostfolio/common/types'; import { Inject, Injectable, Logger, OnModuleInit } from '@nestjs/common'; import { DataSource, MarketData, SymbolProfile } from '@prisma/client'; import { Big } from 'big.js'; -import { eachDayOfInterval, format, isBefore, isValid } from 'date-fns'; +import { eachDayOfInterval, format, isValid } from 'date-fns'; import { groupBy, isEmpty, isNumber, uniqWith } from 'lodash'; import ms from 'ms'; @@ -160,25 +159,9 @@ export class DataProviderService implements OnModuleInit { return DataSource[this.configurationService.get('DATA_SOURCE_IMPORT')]; } - public async getDataSources({ - includeGhostfolio = false, - user - }: { - includeGhostfolio?: boolean; - user: UserWithSettings; - }): Promise { - let dataSourcesKey: 'DATA_SOURCES' | 'DATA_SOURCES_LEGACY' = 'DATA_SOURCES'; - - if ( - !hasRole(user, 'ADMIN') && - isBefore(user.createdAt, new Date('2025-03-23')) && - this.configurationService.get('DATA_SOURCES_LEGACY')?.length > 0 - ) { - dataSourcesKey = 'DATA_SOURCES_LEGACY'; - } - + public async getDataSources(): Promise { const dataSources: DataSource[] = this.configurationService - .get(dataSourcesKey) + .get('DATA_SOURCES') .map((dataSource) => { return DataSource[dataSource]; }); @@ -187,7 +170,7 @@ export class DataProviderService implements OnModuleInit { PROPERTY_API_KEY_GHOSTFOLIO ); - if (includeGhostfolio || ghostfolioApiKey) { + if (ghostfolioApiKey) { dataSources.push('GHOSTFOLIO'); } @@ -634,7 +617,7 @@ export class DataProviderService implements OnModuleInit { return { items: lookupItems }; } - const dataSources = await this.getDataSources({ user }); + const dataSources = await this.getDataSources(); const dataProviderServices = dataSources.map((dataSource) => { return this.getDataProvider(DataSource[dataSource]); diff --git a/apps/api/src/services/interfaces/environment.interface.ts b/apps/api/src/services/interfaces/environment.interface.ts index c0e228429..2f94739fb 100644 --- a/apps/api/src/services/interfaces/environment.interface.ts +++ b/apps/api/src/services/interfaces/environment.interface.ts @@ -16,7 +16,6 @@ export interface Environment extends CleanedEnvAccessors { DATA_SOURCE_IMPORT: string; DATA_SOURCES: string[]; DATA_SOURCES_GHOSTFOLIO_DATA_PROVIDER: string[]; - DATA_SOURCES_LEGACY: string[]; ENABLE_FEATURE_FEAR_AND_GREED_INDEX: boolean; ENABLE_FEATURE_READ_ONLY_MODE: boolean; ENABLE_FEATURE_SOCIAL_LOGIN: boolean;