Browse Source

Feature/remove DATA_SOURCES_LEGACY (#5396)

* Remove DATA_SOURCES_LEGACY
pull/5400/head
Thomas Kaul 6 days ago
committed by GitHub
parent
commit
dad3c27ad9
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      apps/api/src/app/import/import.service.ts
  2. 3
      apps/api/src/services/configuration/configuration.service.ts
  3. 27
      apps/api/src/services/data-provider/data-provider.service.ts
  4. 1
      apps/api/src/services/interfaces/environment.interface.ts

2
apps/api/src/app/import/import.service.ts

@ -712,7 +712,7 @@ export class ImportService {
const assetProfiles: {
[assetProfileIdentifier: string]: Partial<SymbolProfile>;
} = {};
const dataSources = await this.dataProviderService.getDataSources({ user });
const dataSources = await this.dataProviderService.getDataSources();
for (const [
index,

3
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 }),

27
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<DataSource[]> {
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<DataSource[]> {
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]);

1
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;

Loading…
Cancel
Save