Browse Source

Code review changes

pull/4524/head
csehatt741 4 days ago
parent
commit
0ea845100b
  1. 2
      CHANGELOG.md
  2. 2
      apps/api/src/services/data-provider/errors/asset-profile-delisted.error.ts
  3. 3
      apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts
  4. 12
      apps/api/src/services/queues/data-gathering/data-gathering.processor.ts

2
CHANGELOG.md

@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Added the data gathering status column to the historical market data table of the admin control - Added the data gathering status column to the historical market data table of the admin control
- Deactivated asset profile on delisting (Yahoo Finance) - Deactivated asset profiles automatically on delisting in the _Yahoo Finance_ service
### Changed ### Changed

2
apps/api/src/services/data-provider/yahoo-finance/asset-profile-delisted.error.ts → apps/api/src/services/data-provider/errors/asset-profile-delisted.error.ts

@ -1,5 +1,5 @@
export class AssetProfileDelistedError extends Error { export class AssetProfileDelistedError extends Error {
constructor(message: string) { public constructor(message: string) {
super(message); super(message);
this.name = 'AssetProfileDelistedError'; this.name = 'AssetProfileDelistedError';
} }

3
apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts

@ -1,5 +1,6 @@
import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service'; import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service';
import { YahooFinanceDataEnhancerService } from '@ghostfolio/api/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service'; import { YahooFinanceDataEnhancerService } from '@ghostfolio/api/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service';
import { AssetProfileDelistedError } from '@ghostfolio/api/services/data-provider/errors/asset-profile-delisted.error';
import { import {
DataProviderInterface, DataProviderInterface,
GetAssetProfileParams, GetAssetProfileParams,
@ -31,8 +32,6 @@ import {
} from 'yahoo-finance2/dist/esm/src/modules/historical'; } from 'yahoo-finance2/dist/esm/src/modules/historical';
import { Quote } from 'yahoo-finance2/dist/esm/src/modules/quote'; import { Quote } from 'yahoo-finance2/dist/esm/src/modules/quote';
import { AssetProfileDelistedError } from './asset-profile-delisted.error';
@Injectable() @Injectable()
export class YahooFinanceService implements DataProviderInterface { export class YahooFinanceService implements DataProviderInterface {
public constructor( public constructor(

12
apps/api/src/services/queues/data-gathering/data-gathering.processor.ts

@ -1,5 +1,5 @@
import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service';
import { AssetProfileDelistedError } from '@ghostfolio/api/services/data-provider/yahoo-finance/asset-profile-delisted.error'; import { AssetProfileDelistedError } from '@ghostfolio/api/services/data-provider/errors/asset-profile-delisted.error';
import { IDataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces'; import { IDataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces';
import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service';
import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service';
@ -147,17 +147,17 @@ export class DataGatheringProcessor {
); );
} catch (error) { } catch (error) {
if (error instanceof AssetProfileDelistedError) { if (error instanceof AssetProfileDelistedError) {
const updatedSymbolProfile: Prisma.SymbolProfileUpdateInput = {
isActive: false
};
await this.symbolProfileService.updateSymbolProfile( await this.symbolProfileService.updateSymbolProfile(
{ {
dataSource, dataSource,
symbol symbol
}, },
updatedSymbolProfile {
isActive: false
}
); );
await job.discard();
} }
Logger.error( Logger.error(

Loading…
Cancel
Save