From 513a564e2c27cf9dbb97e550e12fb5e9393e5147 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 23 Apr 2023 12:02:01 +0200 Subject: [PATCH] Restructure services (#1891) --- apps/api/src/app/access/access.module.ts | 2 +- apps/api/src/app/access/access.service.ts | 2 +- .../api/src/app/account/account.controller.ts | 2 +- apps/api/src/app/account/account.module.ts | 8 ++--- apps/api/src/app/account/account.service.ts | 4 +-- apps/api/src/app/admin/admin.controller.ts | 4 +-- apps/api/src/app/admin/admin.module.ts | 12 +++---- apps/api/src/app/admin/admin.service.ts | 10 +++--- apps/api/src/app/admin/queue/queue.module.ts | 2 +- apps/api/src/app/app.controller.ts | 2 +- apps/api/src/app/app.module.ts | 14 ++++---- .../src/app/auth-device/auth-device.module.ts | 4 +-- .../app/auth-device/auth-device.service.ts | 4 +-- apps/api/src/app/auth/auth.controller.ts | 2 +- apps/api/src/app/auth/auth.module.ts | 4 +-- apps/api/src/app/auth/auth.service.ts | 2 +- apps/api/src/app/auth/google.strategy.ts | 2 +- apps/api/src/app/auth/jwt.strategy.ts | 4 +-- apps/api/src/app/auth/web-auth.service.ts | 2 +- .../api/src/app/benchmark/benchmark.module.ts | 6 ++-- .../src/app/benchmark/benchmark.service.ts | 4 +-- apps/api/src/app/cache/cache.module.ts | 10 +++--- .../app/exchange-rate/exchange-rate.module.ts | 2 +- .../exchange-rate/exchange-rate.service.ts | 2 +- apps/api/src/app/export/export.module.ts | 6 ++-- apps/api/src/app/export/export.service.ts | 2 +- apps/api/src/app/frontend.middleware.ts | 2 +- apps/api/src/app/health/health.controller.ts | 4 +-- apps/api/src/app/health/health.module.ts | 2 +- apps/api/src/app/import/import.controller.ts | 2 +- apps/api/src/app/import/import.module.ts | 12 +++---- apps/api/src/app/import/import.service.ts | 4 +-- apps/api/src/app/info/info.module.ts | 10 +++--- apps/api/src/app/info/info.service.ts | 6 ++-- apps/api/src/app/logo/logo.module.ts | 4 +-- apps/api/src/app/logo/logo.service.ts | 2 +- apps/api/src/app/order/order.controller.ts | 2 +- apps/api/src/app/order/order.module.ts | 12 +++---- apps/api/src/app/order/order.service.ts | 8 ++--- .../portfolio/current-rate.service.mock.ts | 2 +- .../portfolio/current-rate.service.spec.ts | 33 ++++++++++--------- .../src/app/portfolio/current-rate.service.ts | 6 ++-- .../src/app/portfolio/portfolio.controller.ts | 4 +-- .../api/src/app/portfolio/portfolio.module.ts | 14 ++++---- .../src/app/portfolio/portfolio.service.ts | 8 ++--- .../src/app/redis-cache/redis-cache.module.ts | 4 +-- .../app/redis-cache/redis-cache.service.ts | 2 +- .../subscription/subscription.controller.ts | 2 +- .../app/subscription/subscription.module.ts | 4 +-- .../app/subscription/subscription.service.ts | 4 +-- apps/api/src/app/symbol/symbol.module.ts | 6 ++-- apps/api/src/app/symbol/symbol.service.ts | 2 +- apps/api/src/app/user/user.module.ts | 4 +-- apps/api/src/app/user/user.service.ts | 4 +-- ...form-data-source-in-request.interceptor.ts | 3 +- ...orm-data-source-in-response.interceptor.ts | 3 +- apps/api/src/models/order.ts | 3 +- apps/api/src/models/rule.ts | 2 +- .../current-investment.ts | 2 +- .../initial-investment.ts | 2 +- .../account-cluster-risk/single-account.ts | 2 +- .../base-currency-current-investment.ts | 2 +- .../base-currency-initial-investment.ts | 2 +- .../current-investment.ts | 2 +- .../initial-investment.ts | 2 +- .../fees/fee-ratio-initial-investment.ts | 2 +- .../configuration.module.ts | 2 +- .../configuration.service.ts | 3 +- apps/api/src/services/cron.service.ts | 4 +-- .../data-gathering.module.ts | 12 +++---- .../data-gathering.processor.ts | 6 ++-- .../data-gathering.service.ts | 15 ++++----- .../alpha-vantage/alpha-vantage.service.ts | 2 +- .../coingecko/coingecko.service.ts | 2 +- .../data-enhancer/data-enhancer.module.ts | 2 +- .../yahoo-finance.service.spec.ts | 2 +- .../yahoo-finance/yahoo-finance.service.ts | 2 +- .../data-provider/data-provider.module.ts | 8 ++--- .../data-provider/data-provider.service.ts | 10 +++--- .../eod-historical-data.service.ts | 2 +- .../google-sheets/google-sheets.service.ts | 6 ++-- .../data-provider/manual/manual.service.ts | 4 +-- .../rapid-api/rapid-api.service.ts | 2 +- .../yahoo-finance/yahoo-finance.service.ts | 2 +- .../exchange-rate-data.module.ts | 9 +++-- .../exchange-rate-data.service.ts | 13 ++++---- .../impersonation.module.ts | 4 +-- .../impersonation.service.ts | 3 +- .../{ => market-data}/market-data.module.ts | 2 +- .../{ => market-data}/market-data.service.ts | 5 ++- .../src/services/platform/platform.module.ts | 2 +- .../src/services/platform/platform.service.ts | 2 +- .../services/{ => prisma}/prisma.module.ts | 2 +- .../services/{ => prisma}/prisma.service.ts | 0 .../src/services/property/property.module.ts | 2 +- .../src/services/property/property.service.ts | 2 +- .../symbol-profile.module.ts | 2 +- .../symbol-profile.service.ts | 2 +- apps/api/src/services/tag/tag.module.ts | 2 +- apps/api/src/services/tag/tag.service.ts | 2 +- .../twitter-bot/twitter-bot.module.ts | 2 +- .../twitter-bot/twitter-bot.service.ts | 2 +- apps/client/src/app/app.module.ts | 4 +-- .../accounts-table.component.ts | 2 +- .../accounts-table/accounts-table.module.ts | 2 +- .../market-data-detail-dialog.module.ts | 2 +- .../admin-market-data.component.ts | 2 +- .../admin-market-data.module.ts | 2 +- apps/client/src/app/core/auth.interceptor.ts | 5 ++- ...eate-or-update-account-dialog.component.ts | 2 +- ...create-or-update-activity-dialog.module.ts | 2 +- .../import-activities-dialog.module.ts | 2 +- 112 files changed, 238 insertions(+), 245 deletions(-) rename apps/api/src/services/{ => configuration}/configuration.module.ts (85%) rename apps/api/src/services/{ => configuration}/configuration.service.ts (96%) rename apps/api/src/services/{ => data-gathering}/data-gathering.module.ts (70%) rename apps/api/src/services/{ => data-gathering}/data-gathering.processor.ts (92%) rename apps/api/src/services/{ => data-gathering}/data-gathering.service.ts (94%) rename apps/api/src/services/{ => exchange-rate-data}/exchange-rate-data.module.ts (70%) rename apps/api/src/services/{ => exchange-rate-data}/exchange-rate-data.service.ts (93%) rename apps/api/src/services/{ => impersonation}/impersonation.module.ts (68%) rename apps/api/src/services/{ => impersonation}/impersonation.service.ts (83%) rename apps/api/src/services/{ => market-data}/market-data.module.ts (75%) rename apps/api/src/services/{ => market-data}/market-data.service.ts (95%) rename apps/api/src/services/{ => prisma}/prisma.module.ts (63%) rename apps/api/src/services/{ => prisma}/prisma.service.ts (100%) rename apps/api/src/services/{ => symbol-profile}/symbol-profile.module.ts (76%) rename apps/api/src/services/{ => symbol-profile}/symbol-profile.service.ts (98%) diff --git a/apps/api/src/app/access/access.module.ts b/apps/api/src/app/access/access.module.ts index d70388038..b9813d173 100644 --- a/apps/api/src/app/access/access.module.ts +++ b/apps/api/src/app/access/access.module.ts @@ -1,4 +1,4 @@ -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { Module } from '@nestjs/common'; import { AccessController } from './access.controller'; diff --git a/apps/api/src/app/access/access.service.ts b/apps/api/src/app/access/access.service.ts index f1dc4c6ec..bbaef5f73 100644 --- a/apps/api/src/app/access/access.service.ts +++ b/apps/api/src/app/access/access.service.ts @@ -1,4 +1,4 @@ -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { AccessWithGranteeUser } from '@ghostfolio/common/types'; import { Injectable } from '@nestjs/common'; import { Access, Prisma } from '@prisma/client'; diff --git a/apps/api/src/app/account/account.controller.ts b/apps/api/src/app/account/account.controller.ts index 4f458bcfa..3c4d3db5b 100644 --- a/apps/api/src/app/account/account.controller.ts +++ b/apps/api/src/app/account/account.controller.ts @@ -1,6 +1,6 @@ import { PortfolioService } from '@ghostfolio/api/app/portfolio/portfolio.service'; import { RedactValuesInResponseInterceptor } from '@ghostfolio/api/interceptors/redact-values-in-response.interceptor'; -import { ImpersonationService } from '@ghostfolio/api/services/impersonation.service'; +import { ImpersonationService } from '@ghostfolio/api/services/impersonation/impersonation.service'; import { HEADER_KEY_IMPERSONATION } from '@ghostfolio/common/config'; import { Accounts } from '@ghostfolio/common/interfaces'; import { hasPermission, permissions } from '@ghostfolio/common/permissions'; diff --git a/apps/api/src/app/account/account.module.ts b/apps/api/src/app/account/account.module.ts index 90bf909fc..f37ed34ee 100644 --- a/apps/api/src/app/account/account.module.ts +++ b/apps/api/src/app/account/account.module.ts @@ -1,11 +1,11 @@ import { PortfolioModule } from '@ghostfolio/api/app/portfolio/portfolio.module'; import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module'; import { UserModule } from '@ghostfolio/api/app/user/user.module'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; -import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module'; -import { ImpersonationModule } from '@ghostfolio/api/services/impersonation.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; +import { ImpersonationModule } from '@ghostfolio/api/services/impersonation/impersonation.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { Module } from '@nestjs/common'; import { AccountController } from './account.controller'; diff --git a/apps/api/src/app/account/account.service.ts b/apps/api/src/app/account/account.service.ts index 7c10fc31f..eb3ad8149 100644 --- a/apps/api/src/app/account/account.service.ts +++ b/apps/api/src/app/account/account.service.ts @@ -1,5 +1,5 @@ -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { Filter } from '@ghostfolio/common/interfaces'; import { Injectable } from '@nestjs/common'; import { Account, Order, Platform, Prisma } from '@prisma/client'; diff --git a/apps/api/src/app/admin/admin.controller.ts b/apps/api/src/app/admin/admin.controller.ts index 81fd25308..fc9f779a4 100644 --- a/apps/api/src/app/admin/admin.controller.ts +++ b/apps/api/src/app/admin/admin.controller.ts @@ -1,5 +1,5 @@ -import { DataGatheringService } from '@ghostfolio/api/services/data-gathering.service'; -import { MarketDataService } from '@ghostfolio/api/services/market-data.service'; +import { DataGatheringService } from '@ghostfolio/api/services/data-gathering/data-gathering.service'; +import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; import { PropertyDto } from '@ghostfolio/api/services/property/property.dto'; import { GATHER_ASSET_PROFILE_PROCESS, diff --git a/apps/api/src/app/admin/admin.module.ts b/apps/api/src/app/admin/admin.module.ts index 464ba7069..500af69db 100644 --- a/apps/api/src/app/admin/admin.module.ts +++ b/apps/api/src/app/admin/admin.module.ts @@ -1,12 +1,12 @@ import { SubscriptionModule } from '@ghostfolio/api/app/subscription/subscription.module'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering/data-gathering.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; -import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module'; -import { MarketDataModule } from '@ghostfolio/api/services/market-data.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; +import { MarketDataModule } from '@ghostfolio/api/services/market-data/market-data.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { PropertyModule } from '@ghostfolio/api/services/property/property.module'; -import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile.module'; +import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile/symbol-profile.module'; import { Module } from '@nestjs/common'; import { AdminController } from './admin.controller'; diff --git a/apps/api/src/app/admin/admin.service.ts b/apps/api/src/app/admin/admin.service.ts index 5b5eea63f..db334344d 100644 --- a/apps/api/src/app/admin/admin.service.ts +++ b/apps/api/src/app/admin/admin.service.ts @@ -1,10 +1,10 @@ import { SubscriptionService } from '@ghostfolio/api/app/subscription/subscription.service'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; -import { MarketDataService } from '@ghostfolio/api/services/market-data.service'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; +import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { PropertyService } from '@ghostfolio/api/services/property/property.service'; -import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile.service'; +import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { PROPERTY_CURRENCIES } from '@ghostfolio/common/config'; import { AdminData, diff --git a/apps/api/src/app/admin/queue/queue.module.ts b/apps/api/src/app/admin/queue/queue.module.ts index 62091f34b..3c1be5128 100644 --- a/apps/api/src/app/admin/queue/queue.module.ts +++ b/apps/api/src/app/admin/queue/queue.module.ts @@ -1,4 +1,4 @@ -import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module'; +import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering/data-gathering.module'; import { Module } from '@nestjs/common'; import { QueueController } from './queue.controller'; diff --git a/apps/api/src/app/app.controller.ts b/apps/api/src/app/app.controller.ts index d92a7a3ce..33e9ae56a 100644 --- a/apps/api/src/app/app.controller.ts +++ b/apps/api/src/app/app.controller.ts @@ -1,4 +1,4 @@ -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { Controller } from '@nestjs/common'; @Controller() diff --git a/apps/api/src/app/app.module.ts b/apps/api/src/app/app.module.ts index 0db6d8949..83179a402 100644 --- a/apps/api/src/app/app.module.ts +++ b/apps/api/src/app/app.module.ts @@ -1,18 +1,18 @@ import { join } from 'path'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { CronService } from '@ghostfolio/api/services/cron.service'; +import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering/data-gathering.module'; +import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; +import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; +import { TwitterBotModule } from '@ghostfolio/api/services/twitter-bot/twitter-bot.module'; import { BullModule } from '@nestjs/bull'; import { MiddlewareConsumer, Module, RequestMethod } from '@nestjs/common'; import { ConfigModule } from '@nestjs/config'; import { ScheduleModule } from '@nestjs/schedule'; import { ServeStaticModule } from '@nestjs/serve-static'; -import { ConfigurationModule } from '../services/configuration.module'; -import { CronService } from '../services/cron.service'; -import { DataGatheringModule } from '../services/data-gathering.module'; -import { DataProviderModule } from '../services/data-provider/data-provider.module'; -import { ExchangeRateDataModule } from '../services/exchange-rate-data.module'; -import { PrismaModule } from '../services/prisma.module'; -import { TwitterBotModule } from '../services/twitter-bot/twitter-bot.module'; import { AccessModule } from './access/access.module'; import { AccountModule } from './account/account.module'; import { AdminModule } from './admin/admin.module'; diff --git a/apps/api/src/app/auth-device/auth-device.module.ts b/apps/api/src/app/auth-device/auth-device.module.ts index de6cd1cbc..11ddd58ec 100644 --- a/apps/api/src/app/auth-device/auth-device.module.ts +++ b/apps/api/src/app/auth-device/auth-device.module.ts @@ -1,7 +1,7 @@ import { AuthDeviceController } from '@ghostfolio/api/app/auth-device/auth-device.controller'; import { AuthDeviceService } from '@ghostfolio/api/app/auth-device/auth-device.service'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { Module } from '@nestjs/common'; import { JwtModule } from '@nestjs/jwt'; diff --git a/apps/api/src/app/auth-device/auth-device.service.ts b/apps/api/src/app/auth-device/auth-device.service.ts index 048aca758..19dad8876 100644 --- a/apps/api/src/app/auth-device/auth-device.service.ts +++ b/apps/api/src/app/auth-device/auth-device.service.ts @@ -1,5 +1,5 @@ -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { Injectable } from '@nestjs/common'; import { AuthDevice, Prisma } from '@prisma/client'; diff --git a/apps/api/src/app/auth/auth.controller.ts b/apps/api/src/app/auth/auth.controller.ts index 1050fe5bf..0c6b047bf 100644 --- a/apps/api/src/app/auth/auth.controller.ts +++ b/apps/api/src/app/auth/auth.controller.ts @@ -1,5 +1,5 @@ import { WebAuthService } from '@ghostfolio/api/app/auth/web-auth.service'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config'; import { OAuthResponse } from '@ghostfolio/common/interfaces'; import { diff --git a/apps/api/src/app/auth/auth.module.ts b/apps/api/src/app/auth/auth.module.ts index dfdec5655..458493051 100644 --- a/apps/api/src/app/auth/auth.module.ts +++ b/apps/api/src/app/auth/auth.module.ts @@ -2,8 +2,8 @@ import { AuthDeviceService } from '@ghostfolio/api/app/auth-device/auth-device.s import { WebAuthService } from '@ghostfolio/api/app/auth/web-auth.service'; import { SubscriptionModule } from '@ghostfolio/api/app/subscription/subscription.module'; import { UserModule } from '@ghostfolio/api/app/user/user.module'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { PropertyModule } from '@ghostfolio/api/services/property/property.module'; import { Module } from '@nestjs/common'; import { JwtModule } from '@nestjs/jwt'; diff --git a/apps/api/src/app/auth/auth.service.ts b/apps/api/src/app/auth/auth.service.ts index 2c2dc2fc7..2f31e722b 100644 --- a/apps/api/src/app/auth/auth.service.ts +++ b/apps/api/src/app/auth/auth.service.ts @@ -1,5 +1,5 @@ import { UserService } from '@ghostfolio/api/app/user/user.service'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { PropertyService } from '@ghostfolio/api/services/property/property.service'; import { Injectable, InternalServerErrorException } from '@nestjs/common'; import { JwtService } from '@nestjs/jwt'; diff --git a/apps/api/src/app/auth/google.strategy.ts b/apps/api/src/app/auth/google.strategy.ts index c8fb260b7..7e43f5817 100644 --- a/apps/api/src/app/auth/google.strategy.ts +++ b/apps/api/src/app/auth/google.strategy.ts @@ -1,4 +1,4 @@ -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { Injectable, Logger } from '@nestjs/common'; import { PassportStrategy } from '@nestjs/passport'; import { Provider } from '@prisma/client'; diff --git a/apps/api/src/app/auth/jwt.strategy.ts b/apps/api/src/app/auth/jwt.strategy.ts index af21ecc0e..6d7e2ecdc 100644 --- a/apps/api/src/app/auth/jwt.strategy.ts +++ b/apps/api/src/app/auth/jwt.strategy.ts @@ -1,6 +1,6 @@ import { UserService } from '@ghostfolio/api/app/user/user.service'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { HEADER_KEY_TIMEZONE } from '@ghostfolio/common/config'; import { Injectable, UnauthorizedException } from '@nestjs/common'; import { PassportStrategy } from '@nestjs/passport'; diff --git a/apps/api/src/app/auth/web-auth.service.ts b/apps/api/src/app/auth/web-auth.service.ts index bbfddb673..471b77709 100644 --- a/apps/api/src/app/auth/web-auth.service.ts +++ b/apps/api/src/app/auth/web-auth.service.ts @@ -1,7 +1,7 @@ import { AuthDeviceDto } from '@ghostfolio/api/app/auth-device/auth-device.dto'; import { AuthDeviceService } from '@ghostfolio/api/app/auth-device/auth-device.service'; import { UserService } from '@ghostfolio/api/app/user/user.service'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import type { RequestWithUser } from '@ghostfolio/common/types'; import { Inject, diff --git a/apps/api/src/app/benchmark/benchmark.module.ts b/apps/api/src/app/benchmark/benchmark.module.ts index 4c20e61aa..71b08c191 100644 --- a/apps/api/src/app/benchmark/benchmark.module.ts +++ b/apps/api/src/app/benchmark/benchmark.module.ts @@ -1,10 +1,10 @@ import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module'; import { SymbolModule } from '@ghostfolio/api/app/symbol/symbol.module'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; -import { MarketDataModule } from '@ghostfolio/api/services/market-data.module'; +import { MarketDataModule } from '@ghostfolio/api/services/market-data/market-data.module'; import { PropertyModule } from '@ghostfolio/api/services/property/property.module'; -import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile.module'; +import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile/symbol-profile.module'; import { Module } from '@nestjs/common'; import { BenchmarkController } from './benchmark.controller'; diff --git a/apps/api/src/app/benchmark/benchmark.service.ts b/apps/api/src/app/benchmark/benchmark.service.ts index 015fc7ee7..4e87b26f9 100644 --- a/apps/api/src/app/benchmark/benchmark.service.ts +++ b/apps/api/src/app/benchmark/benchmark.service.ts @@ -1,9 +1,9 @@ import { RedisCacheService } from '@ghostfolio/api/app/redis-cache/redis-cache.service'; import { SymbolService } from '@ghostfolio/api/app/symbol/symbol.service'; import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; -import { MarketDataService } from '@ghostfolio/api/services/market-data.service'; +import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; import { PropertyService } from '@ghostfolio/api/services/property/property.service'; -import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile.service'; +import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { MAX_CHART_ITEMS, PROPERTY_BENCHMARKS diff --git a/apps/api/src/app/cache/cache.module.ts b/apps/api/src/app/cache/cache.module.ts index c079c7942..23b3ea2bb 100644 --- a/apps/api/src/app/cache/cache.module.ts +++ b/apps/api/src/app/cache/cache.module.ts @@ -1,10 +1,10 @@ import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering/data-gathering.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; -import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; -import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile.module'; +import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; +import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile/symbol-profile.module'; import { Module } from '@nestjs/common'; import { CacheController } from './cache.controller'; diff --git a/apps/api/src/app/exchange-rate/exchange-rate.module.ts b/apps/api/src/app/exchange-rate/exchange-rate.module.ts index 04337d010..d94f047f3 100644 --- a/apps/api/src/app/exchange-rate/exchange-rate.module.ts +++ b/apps/api/src/app/exchange-rate/exchange-rate.module.ts @@ -1,4 +1,4 @@ -import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module'; +import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; import { Module } from '@nestjs/common'; import { ExchangeRateController } from './exchange-rate.controller'; diff --git a/apps/api/src/app/exchange-rate/exchange-rate.service.ts b/apps/api/src/app/exchange-rate/exchange-rate.service.ts index d340bb5b3..44a8d0568 100644 --- a/apps/api/src/app/exchange-rate/exchange-rate.service.ts +++ b/apps/api/src/app/exchange-rate/exchange-rate.service.ts @@ -1,4 +1,4 @@ -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { Injectable } from '@nestjs/common'; @Injectable() diff --git a/apps/api/src/app/export/export.module.ts b/apps/api/src/app/export/export.module.ts index dd273c717..186e8dc59 100644 --- a/apps/api/src/app/export/export.module.ts +++ b/apps/api/src/app/export/export.module.ts @@ -1,8 +1,8 @@ import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering/data-gathering.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { Module } from '@nestjs/common'; import { ExportController } from './export.controller'; diff --git a/apps/api/src/app/export/export.service.ts b/apps/api/src/app/export/export.service.ts index c57f1df4e..c8bd651a6 100644 --- a/apps/api/src/app/export/export.service.ts +++ b/apps/api/src/app/export/export.service.ts @@ -1,5 +1,5 @@ import { environment } from '@ghostfolio/api/environments/environment'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { Export } from '@ghostfolio/common/interfaces'; import { Injectable } from '@nestjs/common'; diff --git a/apps/api/src/app/frontend.middleware.ts b/apps/api/src/app/frontend.middleware.ts index baeb5d66d..58e39a5ea 100644 --- a/apps/api/src/app/frontend.middleware.ts +++ b/apps/api/src/app/frontend.middleware.ts @@ -2,7 +2,7 @@ import * as fs from 'fs'; import * as path from 'path'; import { environment } from '@ghostfolio/api/environments/environment'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config'; import { DATE_FORMAT } from '@ghostfolio/common/helper'; import { Injectable, NestMiddleware } from '@nestjs/common'; diff --git a/apps/api/src/app/health/health.controller.ts b/apps/api/src/app/health/health.controller.ts index 699a996dd..d9af97981 100644 --- a/apps/api/src/app/health/health.controller.ts +++ b/apps/api/src/app/health/health.controller.ts @@ -6,11 +6,11 @@ import { Param, UseInterceptors } from '@nestjs/common'; - -import { HealthService } from './health.service'; import { DataSource } from '@prisma/client'; import { StatusCodes, getReasonPhrase } from 'http-status-codes'; +import { HealthService } from './health.service'; + @Controller('health') export class HealthController { public constructor(private readonly healthService: HealthService) {} diff --git a/apps/api/src/app/health/health.module.ts b/apps/api/src/app/health/health.module.ts index 2aab03bfa..1c5292027 100644 --- a/apps/api/src/app/health/health.module.ts +++ b/apps/api/src/app/health/health.module.ts @@ -1,4 +1,4 @@ -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; import { Module } from '@nestjs/common'; diff --git a/apps/api/src/app/import/import.controller.ts b/apps/api/src/app/import/import.controller.ts index 306c722a7..289d103ee 100644 --- a/apps/api/src/app/import/import.controller.ts +++ b/apps/api/src/app/import/import.controller.ts @@ -1,6 +1,6 @@ import { TransformDataSourceInRequestInterceptor } from '@ghostfolio/api/interceptors/transform-data-source-in-request.interceptor'; import { TransformDataSourceInResponseInterceptor } from '@ghostfolio/api/interceptors/transform-data-source-in-response.interceptor'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { ImportResponse } from '@ghostfolio/common/interfaces'; import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import type { RequestWithUser } from '@ghostfolio/common/types'; diff --git a/apps/api/src/app/import/import.module.ts b/apps/api/src/app/import/import.module.ts index 6ae073175..16f4bcdd6 100644 --- a/apps/api/src/app/import/import.module.ts +++ b/apps/api/src/app/import/import.module.ts @@ -3,17 +3,17 @@ import { CacheModule } from '@ghostfolio/api/app/cache/cache.module'; import { OrderModule } from '@ghostfolio/api/app/order/order.module'; import { PortfolioModule } from '@ghostfolio/api/app/portfolio/portfolio.module'; import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering/data-gathering.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; -import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; -import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile.module'; +import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; +import { PlatformModule } from '@ghostfolio/api/services/platform/platform.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; +import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile/symbol-profile.module'; import { Module } from '@nestjs/common'; import { ImportController } from './import.controller'; import { ImportService } from './import.service'; -import { PlatformModule } from '@ghostfolio/api/services/platform/platform.module'; @Module({ controllers: [ImportController], diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.ts index 57358ee54..7d0fda092 100644 --- a/apps/api/src/app/import/import.service.ts +++ b/apps/api/src/app/import/import.service.ts @@ -5,9 +5,9 @@ import { Activity } from '@ghostfolio/api/app/order/interfaces/activities.interf import { OrderService } from '@ghostfolio/api/app/order/order.service'; import { PortfolioService } from '@ghostfolio/api/app/portfolio/portfolio.service'; import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { PlatformService } from '@ghostfolio/api/services/platform/platform.service'; -import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile.service'; +import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { parseDate } from '@ghostfolio/common/helper'; import { UniqueAsset } from '@ghostfolio/common/interfaces'; import { diff --git a/apps/api/src/app/info/info.module.ts b/apps/api/src/app/info/info.module.ts index 4c9c9f9d9..aa2637393 100644 --- a/apps/api/src/app/info/info.module.ts +++ b/apps/api/src/app/info/info.module.ts @@ -1,12 +1,12 @@ import { BenchmarkModule } from '@ghostfolio/api/app/benchmark/benchmark.module'; import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering/data-gathering.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; -import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { PropertyModule } from '@ghostfolio/api/services/property/property.module'; -import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile.module'; +import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile/symbol-profile.module'; import { TagModule } from '@ghostfolio/api/services/tag/tag.module'; import { Module } from '@nestjs/common'; import { JwtModule } from '@nestjs/jwt'; diff --git a/apps/api/src/app/info/info.service.ts b/apps/api/src/app/info/info.service.ts index 6c4d37047..f2cf36ae0 100644 --- a/apps/api/src/app/info/info.service.ts +++ b/apps/api/src/app/info/info.service.ts @@ -1,8 +1,8 @@ import { BenchmarkService } from '@ghostfolio/api/app/benchmark/benchmark.service'; import { RedisCacheService } from '@ghostfolio/api/app/redis-cache/redis-cache.service'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { PropertyService } from '@ghostfolio/api/services/property/property.service'; import { TagService } from '@ghostfolio/api/services/tag/tag.service'; import { diff --git a/apps/api/src/app/logo/logo.module.ts b/apps/api/src/app/logo/logo.module.ts index 518010f39..43052a14f 100644 --- a/apps/api/src/app/logo/logo.module.ts +++ b/apps/api/src/app/logo/logo.module.ts @@ -1,5 +1,5 @@ -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile/symbol-profile.module'; import { Module } from '@nestjs/common'; import { LogoController } from './logo.controller'; diff --git a/apps/api/src/app/logo/logo.service.ts b/apps/api/src/app/logo/logo.service.ts index 3bea44ca9..d2e377fc0 100644 --- a/apps/api/src/app/logo/logo.service.ts +++ b/apps/api/src/app/logo/logo.service.ts @@ -1,4 +1,4 @@ -import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile.service'; +import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { UniqueAsset } from '@ghostfolio/common/interfaces'; import { HttpException, Injectable } from '@nestjs/common'; import { DataSource } from '@prisma/client'; diff --git a/apps/api/src/app/order/order.controller.ts b/apps/api/src/app/order/order.controller.ts index 5e5da4fde..90f8c10b1 100644 --- a/apps/api/src/app/order/order.controller.ts +++ b/apps/api/src/app/order/order.controller.ts @@ -2,7 +2,7 @@ import { RedactValuesInResponseInterceptor } from '@ghostfolio/api/interceptors/ import { TransformDataSourceInRequestInterceptor } from '@ghostfolio/api/interceptors/transform-data-source-in-request.interceptor'; import { TransformDataSourceInResponseInterceptor } from '@ghostfolio/api/interceptors/transform-data-source-in-response.interceptor'; import { ApiService } from '@ghostfolio/api/services/api/api.service'; -import { ImpersonationService } from '@ghostfolio/api/services/impersonation.service'; +import { ImpersonationService } from '@ghostfolio/api/services/impersonation/impersonation.service'; import { HEADER_KEY_IMPERSONATION } from '@ghostfolio/common/config'; import { hasPermission, permissions } from '@ghostfolio/common/permissions'; import type { RequestWithUser } from '@ghostfolio/common/types'; diff --git a/apps/api/src/app/order/order.module.ts b/apps/api/src/app/order/order.module.ts index 7ecc577a5..c8742f9d2 100644 --- a/apps/api/src/app/order/order.module.ts +++ b/apps/api/src/app/order/order.module.ts @@ -3,13 +3,13 @@ import { CacheModule } from '@ghostfolio/api/app/cache/cache.module'; import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module'; import { UserModule } from '@ghostfolio/api/app/user/user.module'; import { ApiModule } from '@ghostfolio/api/services/api/api.module'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering/data-gathering.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; -import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module'; -import { ImpersonationModule } from '@ghostfolio/api/services/impersonation.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; -import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile.module'; +import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; +import { ImpersonationModule } from '@ghostfolio/api/services/impersonation/impersonation.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; +import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile/symbol-profile.module'; import { Module } from '@nestjs/common'; import { OrderController } from './order.controller'; diff --git a/apps/api/src/app/order/order.service.ts b/apps/api/src/app/order/order.service.ts index 50f936148..2403bf495 100644 --- a/apps/api/src/app/order/order.service.ts +++ b/apps/api/src/app/order/order.service.ts @@ -1,8 +1,8 @@ import { AccountService } from '@ghostfolio/api/app/account/account.service'; -import { DataGatheringService } from '@ghostfolio/api/services/data-gathering.service'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; -import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile.service'; +import { DataGatheringService } from '@ghostfolio/api/services/data-gathering/data-gathering.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; +import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { GATHER_ASSET_PROFILE_PROCESS, GATHER_ASSET_PROFILE_PROCESS_OPTIONS diff --git a/apps/api/src/app/portfolio/current-rate.service.mock.ts b/apps/api/src/app/portfolio/current-rate.service.mock.ts index 9fe6b2ec2..a9dc03acf 100644 --- a/apps/api/src/app/portfolio/current-rate.service.mock.ts +++ b/apps/api/src/app/portfolio/current-rate.service.mock.ts @@ -2,8 +2,8 @@ import { parseDate, resetHours } from '@ghostfolio/common/helper'; import { addDays, endOfDay, isBefore, isSameDay } from 'date-fns'; import { GetValueObject } from './interfaces/get-value-object.interface'; -import { GetValuesParams } from './interfaces/get-values-params.interface'; import { GetValuesObject } from './interfaces/get-values-object.interface'; +import { GetValuesParams } from './interfaces/get-values-params.interface'; function mockGetValue(symbol: string, date: Date) { switch (symbol) { diff --git a/apps/api/src/app/portfolio/current-rate.service.spec.ts b/apps/api/src/app/portfolio/current-rate.service.spec.ts index f0e4ea4a9..00062ee60 100644 --- a/apps/api/src/app/portfolio/current-rate.service.spec.ts +++ b/apps/api/src/app/portfolio/current-rate.service.spec.ts @@ -1,13 +1,13 @@ import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; -import { MarketDataService } from '@ghostfolio/api/services/market-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; +import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; import { PropertyService } from '@ghostfolio/api/services/property/property.service'; import { DataSource, MarketData } from '@prisma/client'; import { CurrentRateService } from './current-rate.service'; import { GetValuesObject } from './interfaces/get-values-object.interface'; -jest.mock('@ghostfolio/api/services/market-data.service', () => { +jest.mock('@ghostfolio/api/services/market-data/market-data.service', () => { return { MarketDataService: jest.fn().mockImplementation(() => { return { @@ -54,18 +54,21 @@ jest.mock('@ghostfolio/api/services/market-data.service', () => { }; }); -jest.mock('@ghostfolio/api/services/exchange-rate-data.service', () => { - return { - ExchangeRateDataService: jest.fn().mockImplementation(() => { - return { - initialize: () => Promise.resolve(), - toCurrency: (value: number) => { - return 1 * value; - } - }; - }) - }; -}); +jest.mock( + '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service', + () => { + return { + ExchangeRateDataService: jest.fn().mockImplementation(() => { + return { + initialize: () => Promise.resolve(), + toCurrency: (value: number) => { + return 1 * value; + } + }; + }) + }; + } +); jest.mock('@ghostfolio/api/services/property/property.service', () => { return { diff --git a/apps/api/src/app/portfolio/current-rate.service.ts b/apps/api/src/app/portfolio/current-rate.service.ts index 9ca95d779..6d48573f7 100644 --- a/apps/api/src/app/portfolio/current-rate.service.ts +++ b/apps/api/src/app/portfolio/current-rate.service.ts @@ -1,6 +1,6 @@ import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; -import { MarketDataService } from '@ghostfolio/api/services/market-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; +import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; import { resetHours } from '@ghostfolio/common/helper'; import { DataProviderInfo, ResponseError } from '@ghostfolio/common/interfaces'; import { Injectable } from '@nestjs/common'; @@ -8,8 +8,8 @@ import { isBefore, isToday } from 'date-fns'; import { flatten, isEmpty, uniqBy } from 'lodash'; import { GetValueObject } from './interfaces/get-value-object.interface'; -import { GetValuesParams } from './interfaces/get-values-params.interface'; import { GetValuesObject } from './interfaces/get-values-object.interface'; +import { GetValuesParams } from './interfaces/get-values-params.interface'; @Injectable() export class CurrentRateService { diff --git a/apps/api/src/app/portfolio/portfolio.controller.ts b/apps/api/src/app/portfolio/portfolio.controller.ts index dd6eb0ca6..299db2a1b 100644 --- a/apps/api/src/app/portfolio/portfolio.controller.ts +++ b/apps/api/src/app/portfolio/portfolio.controller.ts @@ -8,8 +8,8 @@ import { RedactValuesInResponseInterceptor } from '@ghostfolio/api/interceptors/ import { TransformDataSourceInRequestInterceptor } from '@ghostfolio/api/interceptors/transform-data-source-in-request.interceptor'; import { TransformDataSourceInResponseInterceptor } from '@ghostfolio/api/interceptors/transform-data-source-in-response.interceptor'; import { ApiService } from '@ghostfolio/api/services/api/api.service'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { HEADER_KEY_IMPERSONATION } from '@ghostfolio/common/config'; import { PortfolioDetails, diff --git a/apps/api/src/app/portfolio/portfolio.module.ts b/apps/api/src/app/portfolio/portfolio.module.ts index bf5829833..fa11476ac 100644 --- a/apps/api/src/app/portfolio/portfolio.module.ts +++ b/apps/api/src/app/portfolio/portfolio.module.ts @@ -3,14 +3,14 @@ import { AccountService } from '@ghostfolio/api/app/account/account.service'; import { OrderModule } from '@ghostfolio/api/app/order/order.module'; import { UserModule } from '@ghostfolio/api/app/user/user.module'; import { ApiModule } from '@ghostfolio/api/services/api/api.module'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering/data-gathering.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; -import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module'; -import { ImpersonationModule } from '@ghostfolio/api/services/impersonation.module'; -import { MarketDataModule } from '@ghostfolio/api/services/market-data.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; -import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile.module'; +import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; +import { ImpersonationModule } from '@ghostfolio/api/services/impersonation/impersonation.module'; +import { MarketDataModule } from '@ghostfolio/api/services/market-data/market-data.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; +import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile/symbol-profile.module'; import { Module } from '@nestjs/common'; import { CurrentRateService } from './current-rate.service'; diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 4e8813630..ff29ccd57 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -14,11 +14,11 @@ import { CurrencyClusterRiskBaseCurrencyInitialInvestment } from '@ghostfolio/ap import { CurrencyClusterRiskCurrentInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/current-investment'; import { CurrencyClusterRiskInitialInvestment } from '@ghostfolio/api/models/rules/currency-cluster-risk/initial-investment'; import { FeeRatioInitialInvestment } from '@ghostfolio/api/models/rules/fees/fee-ratio-initial-investment'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; -import { ImpersonationService } from '@ghostfolio/api/services/impersonation.service'; -import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; +import { ImpersonationService } from '@ghostfolio/api/services/impersonation/impersonation.service'; +import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { EMERGENCY_FUND_TAG_ID, MAX_CHART_ITEMS, diff --git a/apps/api/src/app/redis-cache/redis-cache.module.ts b/apps/api/src/app/redis-cache/redis-cache.module.ts index 299a25bab..41f49c499 100644 --- a/apps/api/src/app/redis-cache/redis-cache.module.ts +++ b/apps/api/src/app/redis-cache/redis-cache.module.ts @@ -1,5 +1,5 @@ -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { CacheManagerOptions, CacheModule, Module } from '@nestjs/common'; import * as redisStore from 'cache-manager-redis-store'; diff --git a/apps/api/src/app/redis-cache/redis-cache.service.ts b/apps/api/src/app/redis-cache/redis-cache.service.ts index f930b3a72..49f736bc5 100644 --- a/apps/api/src/app/redis-cache/redis-cache.service.ts +++ b/apps/api/src/app/redis-cache/redis-cache.service.ts @@ -1,4 +1,4 @@ -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { CACHE_MANAGER, Inject, Injectable } from '@nestjs/common'; import { Cache } from 'cache-manager'; diff --git a/apps/api/src/app/subscription/subscription.controller.ts b/apps/api/src/app/subscription/subscription.controller.ts index 1f1aee649..e063a8636 100644 --- a/apps/api/src/app/subscription/subscription.controller.ts +++ b/apps/api/src/app/subscription/subscription.controller.ts @@ -1,4 +1,4 @@ -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { PropertyService } from '@ghostfolio/api/services/property/property.service'; import { DEFAULT_LANGUAGE_CODE, diff --git a/apps/api/src/app/subscription/subscription.module.ts b/apps/api/src/app/subscription/subscription.module.ts index df0861657..c2c80c135 100644 --- a/apps/api/src/app/subscription/subscription.module.ts +++ b/apps/api/src/app/subscription/subscription.module.ts @@ -1,5 +1,5 @@ -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { PropertyModule } from '@ghostfolio/api/services/property/property.module'; import { Module } from '@nestjs/common'; diff --git a/apps/api/src/app/subscription/subscription.service.ts b/apps/api/src/app/subscription/subscription.service.ts index b339538fc..591721f84 100644 --- a/apps/api/src/app/subscription/subscription.service.ts +++ b/apps/api/src/app/subscription/subscription.service.ts @@ -1,5 +1,5 @@ -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { DEFAULT_LANGUAGE_CODE, PROPERTY_STRIPE_CONFIG diff --git a/apps/api/src/app/symbol/symbol.module.ts b/apps/api/src/app/symbol/symbol.module.ts index 2b47334a6..4d9f2d5eb 100644 --- a/apps/api/src/app/symbol/symbol.module.ts +++ b/apps/api/src/app/symbol/symbol.module.ts @@ -1,7 +1,7 @@ -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; -import { MarketDataModule } from '@ghostfolio/api/services/market-data.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { MarketDataModule } from '@ghostfolio/api/services/market-data/market-data.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { Module } from '@nestjs/common'; import { SymbolController } from './symbol.controller'; diff --git a/apps/api/src/app/symbol/symbol.service.ts b/apps/api/src/app/symbol/symbol.service.ts index 066752388..9a08d7ed5 100644 --- a/apps/api/src/app/symbol/symbol.service.ts +++ b/apps/api/src/app/symbol/symbol.service.ts @@ -3,7 +3,7 @@ import { IDataGatheringItem, IDataProviderHistoricalResponse } from '@ghostfolio/api/services/interfaces/interfaces'; -import { MarketDataService } from '@ghostfolio/api/services/market-data.service'; +import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; import { DATE_FORMAT } from '@ghostfolio/common/helper'; import { HistoricalDataItem } from '@ghostfolio/common/interfaces'; import { UserWithSettings } from '@ghostfolio/common/types'; diff --git a/apps/api/src/app/user/user.module.ts b/apps/api/src/app/user/user.module.ts index 6a705524f..3df366bc1 100644 --- a/apps/api/src/app/user/user.module.ts +++ b/apps/api/src/app/user/user.module.ts @@ -1,6 +1,6 @@ import { SubscriptionModule } from '@ghostfolio/api/app/subscription/subscription.module'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { PropertyModule } from '@ghostfolio/api/services/property/property.module'; import { TagModule } from '@ghostfolio/api/services/tag/tag.module'; import { Module } from '@nestjs/common'; diff --git a/apps/api/src/app/user/user.service.ts b/apps/api/src/app/user/user.service.ts index 420fa0874..aaf4d9bad 100644 --- a/apps/api/src/app/user/user.service.ts +++ b/apps/api/src/app/user/user.service.ts @@ -1,6 +1,6 @@ import { SubscriptionService } from '@ghostfolio/api/app/subscription/subscription.service'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { PropertyService } from '@ghostfolio/api/services/property/property.service'; import { TagService } from '@ghostfolio/api/services/tag/tag.service'; import { PROPERTY_IS_READ_ONLY_MODE, locale } from '@ghostfolio/common/config'; diff --git a/apps/api/src/interceptors/transform-data-source-in-request.interceptor.ts b/apps/api/src/interceptors/transform-data-source-in-request.interceptor.ts index ecef35bb6..6b75a5615 100644 --- a/apps/api/src/interceptors/transform-data-source-in-request.interceptor.ts +++ b/apps/api/src/interceptors/transform-data-source-in-request.interceptor.ts @@ -1,3 +1,4 @@ +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { decodeDataSource } from '@ghostfolio/common/helper'; import { CallHandler, @@ -7,8 +8,6 @@ import { } from '@nestjs/common'; import { Observable } from 'rxjs'; -import { ConfigurationService } from '../services/configuration.service'; - @Injectable() export class TransformDataSourceInRequestInterceptor implements NestInterceptor diff --git a/apps/api/src/interceptors/transform-data-source-in-response.interceptor.ts b/apps/api/src/interceptors/transform-data-source-in-response.interceptor.ts index 0d8b8f264..6968a0f0f 100644 --- a/apps/api/src/interceptors/transform-data-source-in-response.interceptor.ts +++ b/apps/api/src/interceptors/transform-data-source-in-response.interceptor.ts @@ -1,4 +1,5 @@ import { redactAttributes } from '@ghostfolio/api/helper/object.helper'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { encodeDataSource } from '@ghostfolio/common/helper'; import { CallHandler, @@ -10,8 +11,6 @@ import { DataSource } from '@prisma/client'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { ConfigurationService } from '../services/configuration.service'; - @Injectable() export class TransformDataSourceInResponseInterceptor implements NestInterceptor diff --git a/apps/api/src/models/order.ts b/apps/api/src/models/order.ts index 8882ebe37..f24f4455d 100644 --- a/apps/api/src/models/order.ts +++ b/apps/api/src/models/order.ts @@ -1,8 +1,7 @@ +import { IOrder } from '@ghostfolio/api/services/interfaces/interfaces'; import { Account, SymbolProfile, Type as TypeOfOrder } from '@prisma/client'; import { v4 as uuidv4 } from 'uuid'; -import { IOrder } from '../services/interfaces/interfaces'; - export class Order { private account: Account; private currency: string; diff --git a/apps/api/src/models/rule.ts b/apps/api/src/models/rule.ts index ad1629ac3..171da810d 100644 --- a/apps/api/src/models/rule.ts +++ b/apps/api/src/models/rule.ts @@ -1,5 +1,5 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { groupBy } from '@ghostfolio/common/helper'; import { TimelinePosition, UserSettings } from '@ghostfolio/common/interfaces'; diff --git a/apps/api/src/models/rules/account-cluster-risk/current-investment.ts b/apps/api/src/models/rules/account-cluster-risk/current-investment.ts index 078123743..7a6d64809 100644 --- a/apps/api/src/models/rules/account-cluster-risk/current-investment.ts +++ b/apps/api/src/models/rules/account-cluster-risk/current-investment.ts @@ -1,5 +1,5 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { PortfolioDetails, PortfolioPosition, diff --git a/apps/api/src/models/rules/account-cluster-risk/initial-investment.ts b/apps/api/src/models/rules/account-cluster-risk/initial-investment.ts index f490b0d6d..607f71001 100644 --- a/apps/api/src/models/rules/account-cluster-risk/initial-investment.ts +++ b/apps/api/src/models/rules/account-cluster-risk/initial-investment.ts @@ -1,5 +1,5 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { PortfolioDetails, PortfolioPosition, diff --git a/apps/api/src/models/rules/account-cluster-risk/single-account.ts b/apps/api/src/models/rules/account-cluster-risk/single-account.ts index 7d75ef4d6..3be323d7c 100644 --- a/apps/api/src/models/rules/account-cluster-risk/single-account.ts +++ b/apps/api/src/models/rules/account-cluster-risk/single-account.ts @@ -1,5 +1,5 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { PortfolioDetails, UserSettings } from '@ghostfolio/common/interfaces'; import { Rule } from '../../rule'; diff --git a/apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts b/apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts index 1d584b04f..64f8852fe 100644 --- a/apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts +++ b/apps/api/src/models/rules/currency-cluster-risk/base-currency-current-investment.ts @@ -1,5 +1,5 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { TimelinePosition, UserSettings } from '@ghostfolio/common/interfaces'; import { Rule } from '../../rule'; diff --git a/apps/api/src/models/rules/currency-cluster-risk/base-currency-initial-investment.ts b/apps/api/src/models/rules/currency-cluster-risk/base-currency-initial-investment.ts index c8a3c8b26..45205b2f9 100644 --- a/apps/api/src/models/rules/currency-cluster-risk/base-currency-initial-investment.ts +++ b/apps/api/src/models/rules/currency-cluster-risk/base-currency-initial-investment.ts @@ -1,5 +1,5 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { TimelinePosition, UserSettings } from '@ghostfolio/common/interfaces'; import { Rule } from '../../rule'; diff --git a/apps/api/src/models/rules/currency-cluster-risk/current-investment.ts b/apps/api/src/models/rules/currency-cluster-risk/current-investment.ts index 402eddf3f..2a86ed6f6 100644 --- a/apps/api/src/models/rules/currency-cluster-risk/current-investment.ts +++ b/apps/api/src/models/rules/currency-cluster-risk/current-investment.ts @@ -1,5 +1,5 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { TimelinePosition, UserSettings } from '@ghostfolio/common/interfaces'; import { Rule } from '../../rule'; diff --git a/apps/api/src/models/rules/currency-cluster-risk/initial-investment.ts b/apps/api/src/models/rules/currency-cluster-risk/initial-investment.ts index 18477f6f7..65009e346 100644 --- a/apps/api/src/models/rules/currency-cluster-risk/initial-investment.ts +++ b/apps/api/src/models/rules/currency-cluster-risk/initial-investment.ts @@ -1,5 +1,5 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { TimelinePosition, UserSettings } from '@ghostfolio/common/interfaces'; import { Rule } from '../../rule'; diff --git a/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts b/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts index d3e4ea827..90f26198f 100644 --- a/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts +++ b/apps/api/src/models/rules/fees/fee-ratio-initial-investment.ts @@ -1,5 +1,5 @@ import { RuleSettings } from '@ghostfolio/api/models/interfaces/rule-settings.interface'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; import { UserSettings } from '@ghostfolio/common/interfaces'; import { Rule } from '../../rule'; diff --git a/apps/api/src/services/configuration.module.ts b/apps/api/src/services/configuration/configuration.module.ts similarity index 85% rename from apps/api/src/services/configuration.module.ts rename to apps/api/src/services/configuration/configuration.module.ts index b91475941..61b8bb4af 100644 --- a/apps/api/src/services/configuration.module.ts +++ b/apps/api/src/services/configuration/configuration.module.ts @@ -1,4 +1,4 @@ -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { Module } from '@nestjs/common'; @Module({ diff --git a/apps/api/src/services/configuration.service.ts b/apps/api/src/services/configuration/configuration.service.ts similarity index 96% rename from apps/api/src/services/configuration.service.ts rename to apps/api/src/services/configuration/configuration.service.ts index c4c3c4834..df9d6fa24 100644 --- a/apps/api/src/services/configuration.service.ts +++ b/apps/api/src/services/configuration/configuration.service.ts @@ -1,9 +1,8 @@ +import { Environment } from '@ghostfolio/api/services/interfaces/environment.interface'; import { Injectable } from '@nestjs/common'; import { DataSource } from '@prisma/client'; import { bool, cleanEnv, host, json, num, port, str } from 'envalid'; -import { Environment } from './interfaces/environment.interface'; - @Injectable() export class ConfigurationService { private readonly environmentConfiguration: Environment; diff --git a/apps/api/src/services/cron.service.ts b/apps/api/src/services/cron.service.ts index c4515d477..72043b36b 100644 --- a/apps/api/src/services/cron.service.ts +++ b/apps/api/src/services/cron.service.ts @@ -5,8 +5,8 @@ import { import { Injectable } from '@nestjs/common'; import { Cron, CronExpression } from '@nestjs/schedule'; -import { DataGatheringService } from './data-gathering.service'; -import { ExchangeRateDataService } from './exchange-rate-data.service'; +import { DataGatheringService } from './data-gathering/data-gathering.service'; +import { ExchangeRateDataService } from './exchange-rate-data/exchange-rate-data.service'; import { TwitterBotService } from './twitter-bot/twitter-bot.service'; @Injectable() diff --git a/apps/api/src/services/data-gathering.module.ts b/apps/api/src/services/data-gathering/data-gathering.module.ts similarity index 70% rename from apps/api/src/services/data-gathering.module.ts rename to apps/api/src/services/data-gathering/data-gathering.module.ts index 0083a8d75..50131bbe8 100644 --- a/apps/api/src/services/data-gathering.module.ts +++ b/apps/api/src/services/data-gathering/data-gathering.module.ts @@ -1,17 +1,17 @@ -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; -import { DataGatheringService } from '@ghostfolio/api/services/data-gathering.service'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; +import { DataGatheringService } from '@ghostfolio/api/services/data-gathering/data-gathering.service'; import { DataEnhancerModule } from '@ghostfolio/api/services/data-provider/data-enhancer/data-enhancer.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.module'; +import { MarketDataModule } from '@ghostfolio/api/services/market-data/market-data.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; +import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile/symbol-profile.module'; import { DATA_GATHERING_QUEUE } from '@ghostfolio/common/config'; import { BullModule } from '@nestjs/bull'; import { Module } from '@nestjs/common'; import ms from 'ms'; import { DataGatheringProcessor } from './data-gathering.processor'; -import { ExchangeRateDataModule } from './exchange-rate-data.module'; -import { MarketDataModule } from './market-data.module'; -import { SymbolProfileModule } from './symbol-profile.module'; @Module({ imports: [ diff --git a/apps/api/src/services/data-gathering.processor.ts b/apps/api/src/services/data-gathering/data-gathering.processor.ts similarity index 92% rename from apps/api/src/services/data-gathering.processor.ts rename to apps/api/src/services/data-gathering/data-gathering.processor.ts index 7e2a27642..b18bc3969 100644 --- a/apps/api/src/services/data-gathering.processor.ts +++ b/apps/api/src/services/data-gathering/data-gathering.processor.ts @@ -1,3 +1,6 @@ +import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; +import { IDataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { DATA_GATHERING_QUEUE, GATHER_ASSET_PROFILE_PROCESS, @@ -18,9 +21,6 @@ import { } from 'date-fns'; import { DataGatheringService } from './data-gathering.service'; -import { DataProviderService } from './data-provider/data-provider.service'; -import { IDataGatheringItem } from './interfaces/interfaces'; -import { PrismaService } from './prisma.service'; @Injectable() @Processor(DATA_GATHERING_QUEUE) diff --git a/apps/api/src/services/data-gathering.service.ts b/apps/api/src/services/data-gathering/data-gathering.service.ts similarity index 94% rename from apps/api/src/services/data-gathering.service.ts rename to apps/api/src/services/data-gathering/data-gathering.service.ts index e4f8c0b38..8b1ea705d 100644 --- a/apps/api/src/services/data-gathering.service.ts +++ b/apps/api/src/services/data-gathering/data-gathering.service.ts @@ -1,4 +1,10 @@ -import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile.service'; +import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; +import { DataEnhancerInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-enhancer.interface'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; +import { IDataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces'; +import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; +import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { DATA_GATHERING_QUEUE, GATHER_HISTORICAL_MARKET_DATA_PROCESS, @@ -13,13 +19,6 @@ import { JobOptions, Queue } from 'bull'; import { format, min, subDays, subYears } from 'date-fns'; import { isEmpty } from 'lodash'; -import { DataProviderService } from './data-provider/data-provider.service'; -import { DataEnhancerInterface } from './data-provider/interfaces/data-enhancer.interface'; -import { ExchangeRateDataService } from './exchange-rate-data.service'; -import { IDataGatheringItem } from './interfaces/interfaces'; -import { MarketDataService } from './market-data.service'; -import { PrismaService } from './prisma.service'; - @Injectable() export class DataGatheringService { public constructor( diff --git a/apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts b/apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts index fed0a71ce..2ac2390b3 100644 --- a/apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts +++ b/apps/api/src/services/data-provider/alpha-vantage/alpha-vantage.service.ts @@ -1,5 +1,5 @@ import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { DataProviderInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-provider.interface'; import { IDataProviderHistoricalResponse, diff --git a/apps/api/src/services/data-provider/coingecko/coingecko.service.ts b/apps/api/src/services/data-provider/coingecko/coingecko.service.ts index fd461a3d9..94ec926a6 100644 --- a/apps/api/src/services/data-provider/coingecko/coingecko.service.ts +++ b/apps/api/src/services/data-provider/coingecko/coingecko.service.ts @@ -1,5 +1,5 @@ import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { DataProviderInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-provider.interface'; import { IDataProviderHistoricalResponse, diff --git a/apps/api/src/services/data-provider/data-enhancer/data-enhancer.module.ts b/apps/api/src/services/data-provider/data-enhancer/data-enhancer.module.ts index d7b7d00a5..a658ef448 100644 --- a/apps/api/src/services/data-provider/data-enhancer/data-enhancer.module.ts +++ b/apps/api/src/services/data-provider/data-enhancer/data-enhancer.module.ts @@ -1,4 +1,4 @@ -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; import { CryptocurrencyModule } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.module'; import { TrackinsightDataEnhancerService } from '@ghostfolio/api/services/data-provider/data-enhancer/trackinsight/trackinsight.service'; import { YahooFinanceDataEnhancerService } from '@ghostfolio/api/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service'; diff --git a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.spec.ts b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.spec.ts index 1dd7f0f0a..951a623d0 100644 --- a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.spec.ts +++ b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.spec.ts @@ -1,4 +1,4 @@ -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service'; import { YahooFinanceDataEnhancerService } from './yahoo-finance.service'; diff --git a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts index 32bcd42c3..1c8b96292 100644 --- a/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts +++ b/apps/api/src/services/data-provider/data-enhancer/yahoo-finance/yahoo-finance.service.ts @@ -1,4 +1,4 @@ -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { CryptocurrencyService } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.service'; import { DataEnhancerInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-enhancer.interface'; import { UNKNOWN_KEY } from '@ghostfolio/common/config'; diff --git a/apps/api/src/services/data-provider/data-provider.module.ts b/apps/api/src/services/data-provider/data-provider.module.ts index b27d5faed..9164b0c0b 100644 --- a/apps/api/src/services/data-provider/data-provider.module.ts +++ b/apps/api/src/services/data-provider/data-provider.module.ts @@ -1,4 +1,4 @@ -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; import { CryptocurrencyModule } from '@ghostfolio/api/services/cryptocurrency/cryptocurrency.module'; import { AlphaVantageService } from '@ghostfolio/api/services/data-provider/alpha-vantage/alpha-vantage.service'; import { CoinGeckoService } from '@ghostfolio/api/services/data-provider/coingecko/coingecko.service'; @@ -7,10 +7,10 @@ import { GoogleSheetsService } from '@ghostfolio/api/services/data-provider/goog import { ManualService } from '@ghostfolio/api/services/data-provider/manual/manual.service'; import { RapidApiService } from '@ghostfolio/api/services/data-provider/rapid-api/rapid-api.service'; import { YahooFinanceService } from '@ghostfolio/api/services/data-provider/yahoo-finance/yahoo-finance.service'; -import { MarketDataModule } from '@ghostfolio/api/services/market-data.module'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { MarketDataModule } from '@ghostfolio/api/services/market-data/market-data.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { PropertyModule } from '@ghostfolio/api/services/property/property.module'; -import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile.module'; +import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile/symbol-profile.module'; import { Module } from '@nestjs/common'; import { DataEnhancerModule } from './data-enhancer/data-enhancer.module'; 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 0823af704..6455252c3 100644 --- a/apps/api/src/services/data-provider/data-provider.service.ts +++ b/apps/api/src/services/data-provider/data-provider.service.ts @@ -1,13 +1,15 @@ import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { DataProviderInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-provider.interface'; import { IDataGatheringItem, IDataProviderHistoricalResponse, IDataProviderResponse } from '@ghostfolio/api/services/interfaces/interfaces'; -import { MarketDataService } from '@ghostfolio/api/services/market-data.service'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; +import { PropertyService } from '@ghostfolio/api/services/property/property.service'; +import { PROPERTY_DATA_SOURCE_MAPPING } from '@ghostfolio/common/config'; import { DATE_FORMAT, getStartOfUtcDate } from '@ghostfolio/common/helper'; import { UserWithSettings } from '@ghostfolio/common/types'; import { Granularity } from '@ghostfolio/common/types'; @@ -15,8 +17,6 @@ import { Inject, Injectable, Logger } from '@nestjs/common'; import { DataSource, MarketData, SymbolProfile } from '@prisma/client'; import { format, isValid } from 'date-fns'; import { groupBy, isEmpty, isNumber } from 'lodash'; -import { PropertyService } from '@ghostfolio/api/services/property/property.service'; -import { PROPERTY_DATA_SOURCE_MAPPING } from '@ghostfolio/common/config'; @Injectable() export class DataProviderService { diff --git a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts index b9038a285..614ec46a8 100644 --- a/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts +++ b/apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts @@ -1,5 +1,5 @@ import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { DataProviderInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-provider.interface'; import { IDataProviderHistoricalResponse, diff --git a/apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts b/apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts index cc4c6af2b..1c24f2638 100644 --- a/apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts +++ b/apps/api/src/services/data-provider/google-sheets/google-sheets.service.ts @@ -1,12 +1,12 @@ import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { DataProviderInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-provider.interface'; import { IDataProviderHistoricalResponse, IDataProviderResponse } from '@ghostfolio/api/services/interfaces/interfaces'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; -import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; +import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { DATE_FORMAT, parseDate } from '@ghostfolio/common/helper'; import { Granularity } from '@ghostfolio/common/types'; import { Injectable, Logger } from '@nestjs/common'; diff --git a/apps/api/src/services/data-provider/manual/manual.service.ts b/apps/api/src/services/data-provider/manual/manual.service.ts index 9d92628e9..ccc737695 100644 --- a/apps/api/src/services/data-provider/manual/manual.service.ts +++ b/apps/api/src/services/data-provider/manual/manual.service.ts @@ -4,8 +4,8 @@ import { IDataProviderHistoricalResponse, IDataProviderResponse } from '@ghostfolio/api/services/interfaces/interfaces'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; -import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; +import { SymbolProfileService } from '@ghostfolio/api/services/symbol-profile/symbol-profile.service'; import { DATE_FORMAT, extractNumberFromString, diff --git a/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts b/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts index f8ad2d8a1..82b9cbae9 100644 --- a/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts +++ b/apps/api/src/services/data-provider/rapid-api/rapid-api.service.ts @@ -1,5 +1,5 @@ import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { DataProviderInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-provider.interface'; import { IDataProviderHistoricalResponse, diff --git a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts index 680687b3b..9d20d9493 100644 --- a/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts +++ b/apps/api/src/services/data-provider/yahoo-finance/yahoo-finance.service.ts @@ -1,5 +1,5 @@ import { LookupItem } from '@ghostfolio/api/app/symbol/interfaces/lookup-item.interface'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.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 { DataProviderInterface } from '@ghostfolio/api/services/data-provider/interfaces/data-provider.interface'; diff --git a/apps/api/src/services/exchange-rate-data.module.ts b/apps/api/src/services/exchange-rate-data/exchange-rate-data.module.ts similarity index 70% rename from apps/api/src/services/exchange-rate-data.module.ts rename to apps/api/src/services/exchange-rate-data/exchange-rate-data.module.ts index fbbaa98a6..89b0158db 100644 --- a/apps/api/src/services/exchange-rate-data.module.ts +++ b/apps/api/src/services/exchange-rate-data/exchange-rate-data.module.ts @@ -1,12 +1,11 @@ -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; -import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data.service'; +import { ExchangeRateDataService } from '@ghostfolio/api/services/exchange-rate-data/exchange-rate-data.service'; +import { MarketDataModule } from '@ghostfolio/api/services/market-data/market-data.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { PropertyModule } from '@ghostfolio/api/services/property/property.module'; import { Module } from '@nestjs/common'; -import { MarketDataModule } from './market-data.module'; -import { PrismaModule } from './prisma.module'; - @Module({ exports: [ExchangeRateDataService], imports: [ diff --git a/apps/api/src/services/exchange-rate-data.service.ts b/apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts similarity index 93% rename from apps/api/src/services/exchange-rate-data.service.ts rename to apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts index 1523c9024..10aef9411 100644 --- a/apps/api/src/services/exchange-rate-data.service.ts +++ b/apps/api/src/services/exchange-rate-data/exchange-rate-data.service.ts @@ -1,16 +1,15 @@ +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; +import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; +import { IDataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces'; +import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; +import { PropertyService } from '@ghostfolio/api/services/property/property.service'; import { PROPERTY_CURRENCIES } from '@ghostfolio/common/config'; import { DATE_FORMAT, getYesterday } from '@ghostfolio/common/helper'; import { Injectable, Logger } from '@nestjs/common'; import { format, isToday } from 'date-fns'; import { isNumber, uniq } from 'lodash'; -import { ConfigurationService } from './configuration.service'; -import { DataProviderService } from './data-provider/data-provider.service'; -import { IDataGatheringItem } from './interfaces/interfaces'; -import { MarketDataService } from './market-data.service'; -import { PrismaService } from './prisma.service'; -import { PropertyService } from './property/property.service'; - @Injectable() export class ExchangeRateDataService { private baseCurrency: string; diff --git a/apps/api/src/services/impersonation.module.ts b/apps/api/src/services/impersonation/impersonation.module.ts similarity index 68% rename from apps/api/src/services/impersonation.module.ts rename to apps/api/src/services/impersonation/impersonation.module.ts index 00be6e68f..506fb7f91 100644 --- a/apps/api/src/services/impersonation.module.ts +++ b/apps/api/src/services/impersonation/impersonation.module.ts @@ -1,5 +1,5 @@ -import { ImpersonationService } from '@ghostfolio/api/services/impersonation.service'; -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { ImpersonationService } from '@ghostfolio/api/services/impersonation/impersonation.service'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { Module } from '@nestjs/common'; @Module({ diff --git a/apps/api/src/services/impersonation.service.ts b/apps/api/src/services/impersonation/impersonation.service.ts similarity index 83% rename from apps/api/src/services/impersonation.service.ts rename to apps/api/src/services/impersonation/impersonation.service.ts index 8082a8198..fe17127c8 100644 --- a/apps/api/src/services/impersonation.service.ts +++ b/apps/api/src/services/impersonation/impersonation.service.ts @@ -1,7 +1,6 @@ +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { Injectable } from '@nestjs/common'; -import { PrismaService } from './prisma.service'; - @Injectable() export class ImpersonationService { public constructor(private readonly prismaService: PrismaService) {} diff --git a/apps/api/src/services/market-data.module.ts b/apps/api/src/services/market-data/market-data.module.ts similarity index 75% rename from apps/api/src/services/market-data.module.ts rename to apps/api/src/services/market-data/market-data.module.ts index b1a09fa91..32367d5c0 100644 --- a/apps/api/src/services/market-data.module.ts +++ b/apps/api/src/services/market-data/market-data.module.ts @@ -1,4 +1,4 @@ -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { Module } from '@nestjs/common'; import { MarketDataService } from './market-data.service'; diff --git a/apps/api/src/services/market-data.service.ts b/apps/api/src/services/market-data/market-data.service.ts similarity index 95% rename from apps/api/src/services/market-data.service.ts rename to apps/api/src/services/market-data/market-data.service.ts index ced802a3f..f7bffe431 100644 --- a/apps/api/src/services/market-data.service.ts +++ b/apps/api/src/services/market-data/market-data.service.ts @@ -1,13 +1,12 @@ import { UpdateMarketDataDto } from '@ghostfolio/api/app/admin/update-market-data.dto'; import { DateQuery } from '@ghostfolio/api/app/portfolio/interfaces/date-query.interface'; -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { IDataGatheringItem } from '@ghostfolio/api/services/interfaces/interfaces'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { resetHours } from '@ghostfolio/common/helper'; import { UniqueAsset } from '@ghostfolio/common/interfaces'; import { Injectable } from '@nestjs/common'; import { DataSource, MarketData, Prisma } from '@prisma/client'; -import { IDataGatheringItem } from './interfaces/interfaces'; - @Injectable() export class MarketDataService { public constructor(private readonly prismaService: PrismaService) {} diff --git a/apps/api/src/services/platform/platform.module.ts b/apps/api/src/services/platform/platform.module.ts index d6befa986..8167a37e0 100644 --- a/apps/api/src/services/platform/platform.module.ts +++ b/apps/api/src/services/platform/platform.module.ts @@ -1,4 +1,4 @@ -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { Module } from '@nestjs/common'; import { PlatformService } from './platform.service'; diff --git a/apps/api/src/services/platform/platform.service.ts b/apps/api/src/services/platform/platform.service.ts index 32d3370fc..51bd4d73d 100644 --- a/apps/api/src/services/platform/platform.service.ts +++ b/apps/api/src/services/platform/platform.service.ts @@ -1,4 +1,4 @@ -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { Injectable } from '@nestjs/common'; @Injectable() diff --git a/apps/api/src/services/prisma.module.ts b/apps/api/src/services/prisma/prisma.module.ts similarity index 63% rename from apps/api/src/services/prisma.module.ts rename to apps/api/src/services/prisma/prisma.module.ts index ee8c8b8c5..7cd76d314 100644 --- a/apps/api/src/services/prisma.module.ts +++ b/apps/api/src/services/prisma/prisma.module.ts @@ -1,4 +1,4 @@ -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { Module } from '@nestjs/common'; @Module({ diff --git a/apps/api/src/services/prisma.service.ts b/apps/api/src/services/prisma/prisma.service.ts similarity index 100% rename from apps/api/src/services/prisma.service.ts rename to apps/api/src/services/prisma/prisma.service.ts diff --git a/apps/api/src/services/property/property.module.ts b/apps/api/src/services/property/property.module.ts index fcd89de40..50fba955d 100644 --- a/apps/api/src/services/property/property.module.ts +++ b/apps/api/src/services/property/property.module.ts @@ -1,4 +1,4 @@ -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { Module } from '@nestjs/common'; import { PropertyService } from './property.service'; diff --git a/apps/api/src/services/property/property.service.ts b/apps/api/src/services/property/property.service.ts index 69e7ff46b..cb5902cd5 100644 --- a/apps/api/src/services/property/property.service.ts +++ b/apps/api/src/services/property/property.service.ts @@ -1,4 +1,4 @@ -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { PROPERTY_CURRENCIES, PROPERTY_IS_USER_SIGNUP_ENABLED diff --git a/apps/api/src/services/symbol-profile.module.ts b/apps/api/src/services/symbol-profile/symbol-profile.module.ts similarity index 76% rename from apps/api/src/services/symbol-profile.module.ts rename to apps/api/src/services/symbol-profile/symbol-profile.module.ts index ac1337e87..fb3fc4d62 100644 --- a/apps/api/src/services/symbol-profile.module.ts +++ b/apps/api/src/services/symbol-profile/symbol-profile.module.ts @@ -1,4 +1,4 @@ -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { Module } from '@nestjs/common'; import { SymbolProfileService } from './symbol-profile.service'; diff --git a/apps/api/src/services/symbol-profile.service.ts b/apps/api/src/services/symbol-profile/symbol-profile.service.ts similarity index 98% rename from apps/api/src/services/symbol-profile.service.ts rename to apps/api/src/services/symbol-profile/symbol-profile.service.ts index 75c386bd0..d78270cac 100644 --- a/apps/api/src/services/symbol-profile.service.ts +++ b/apps/api/src/services/symbol-profile/symbol-profile.service.ts @@ -1,4 +1,4 @@ -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { UNKNOWN_KEY } from '@ghostfolio/common/config'; import { EnhancedSymbolProfile, diff --git a/apps/api/src/services/tag/tag.module.ts b/apps/api/src/services/tag/tag.module.ts index 32d905884..76ed9fcd6 100644 --- a/apps/api/src/services/tag/tag.module.ts +++ b/apps/api/src/services/tag/tag.module.ts @@ -1,4 +1,4 @@ -import { PrismaModule } from '@ghostfolio/api/services/prisma.module'; +import { PrismaModule } from '@ghostfolio/api/services/prisma/prisma.module'; import { Module } from '@nestjs/common'; import { TagService } from './tag.service'; diff --git a/apps/api/src/services/tag/tag.service.ts b/apps/api/src/services/tag/tag.service.ts index 534a6e73d..c02345784 100644 --- a/apps/api/src/services/tag/tag.service.ts +++ b/apps/api/src/services/tag/tag.service.ts @@ -1,4 +1,4 @@ -import { PrismaService } from '@ghostfolio/api/services/prisma.service'; +import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; import { Injectable } from '@nestjs/common'; @Injectable() diff --git a/apps/api/src/services/twitter-bot/twitter-bot.module.ts b/apps/api/src/services/twitter-bot/twitter-bot.module.ts index c810dad4a..d4d565cb1 100644 --- a/apps/api/src/services/twitter-bot/twitter-bot.module.ts +++ b/apps/api/src/services/twitter-bot/twitter-bot.module.ts @@ -1,6 +1,6 @@ import { BenchmarkModule } from '@ghostfolio/api/app/benchmark/benchmark.module'; import { SymbolModule } from '@ghostfolio/api/app/symbol/symbol.module'; -import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; +import { ConfigurationModule } from '@ghostfolio/api/services/configuration/configuration.module'; import { TwitterBotService } from '@ghostfolio/api/services/twitter-bot/twitter-bot.service'; import { Module } from '@nestjs/common'; diff --git a/apps/api/src/services/twitter-bot/twitter-bot.service.ts b/apps/api/src/services/twitter-bot/twitter-bot.service.ts index 40e9c9cf2..218dd291f 100644 --- a/apps/api/src/services/twitter-bot/twitter-bot.service.ts +++ b/apps/api/src/services/twitter-bot/twitter-bot.service.ts @@ -1,6 +1,6 @@ import { BenchmarkService } from '@ghostfolio/api/app/benchmark/benchmark.service'; import { SymbolService } from '@ghostfolio/api/app/symbol/symbol.service'; -import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; +import { ConfigurationService } from '@ghostfolio/api/services/configuration/configuration.service'; import { ghostfolioFearAndGreedIndexDataSource, ghostfolioFearAndGreedIndexSymbol diff --git a/apps/client/src/app/app.module.ts b/apps/client/src/app/app.module.ts index da478ce23..7b26139c3 100644 --- a/apps/client/src/app/app.module.ts +++ b/apps/client/src/app/app.module.ts @@ -1,14 +1,14 @@ import { Platform } from '@angular/cdk/platform'; import { HttpClientModule } from '@angular/common/http'; import { NgModule } from '@angular/core'; +import { MatAutocompleteModule } from '@angular/material/autocomplete'; +import { MatChipsModule } from '@angular/material/chips'; import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core'; -import { MatAutocompleteModule } from '@angular/material/autocomplete'; -import { MatChipsModule } from '@angular/material/chips'; import { MatSnackBarModule } from '@angular/material/snack-bar'; import { MatTooltipModule } from '@angular/material/tooltip'; import { BrowserModule } from '@angular/platform-browser'; diff --git a/apps/client/src/app/components/accounts-table/accounts-table.component.ts b/apps/client/src/app/components/accounts-table/accounts-table.component.ts index 03b52a6d0..8ec0f86fb 100644 --- a/apps/client/src/app/components/accounts-table/accounts-table.component.ts +++ b/apps/client/src/app/components/accounts-table/accounts-table.component.ts @@ -9,8 +9,8 @@ import { Output, ViewChild } from '@angular/core'; -import { MatTableDataSource } from '@angular/material/table'; import { MatSort } from '@angular/material/sort'; +import { MatTableDataSource } from '@angular/material/table'; import { Router } from '@angular/router'; import { Account as AccountModel } from '@prisma/client'; import { get } from 'lodash'; diff --git a/apps/client/src/app/components/accounts-table/accounts-table.module.ts b/apps/client/src/app/components/accounts-table/accounts-table.module.ts index b8e38b30e..7dad41dbf 100644 --- a/apps/client/src/app/components/accounts-table/accounts-table.module.ts +++ b/apps/client/src/app/components/accounts-table/accounts-table.module.ts @@ -2,8 +2,8 @@ import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { MatMenuModule } from '@angular/material/menu'; -import { MatTableModule } from '@angular/material/table'; import { MatSortModule } from '@angular/material/sort'; +import { MatTableModule } from '@angular/material/table'; import { RouterModule } from '@angular/router'; import { GfSymbolIconModule } from '@ghostfolio/client/components/symbol-icon/symbol-icon.module'; import { GfValueModule } from '@ghostfolio/ui/value'; diff --git a/apps/client/src/app/components/admin-market-data-detail/market-data-detail-dialog/market-data-detail-dialog.module.ts b/apps/client/src/app/components/admin-market-data-detail/market-data-detail-dialog/market-data-detail-dialog.module.ts index 452a68d07..f3b55d71d 100644 --- a/apps/client/src/app/components/admin-market-data-detail/market-data-detail-dialog/market-data-detail-dialog.module.ts +++ b/apps/client/src/app/components/admin-market-data-detail/market-data-detail-dialog/market-data-detail-dialog.module.ts @@ -3,9 +3,9 @@ import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatDialogModule } from '@angular/material/dialog'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatInputModule } from '@angular/material/input'; -import { MatDialogModule } from '@angular/material/dialog'; import { MarketDataDetailDialog } from './market-data-detail-dialog.component'; diff --git a/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts b/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts index 556fdf761..a45703562 100644 --- a/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts +++ b/apps/client/src/app/components/admin-market-data/admin-market-data.component.ts @@ -7,8 +7,8 @@ import { ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; -import { MatTableDataSource } from '@angular/material/table'; import { MatSort } from '@angular/material/sort'; +import { MatTableDataSource } from '@angular/material/table'; import { ActivatedRoute, Router } from '@angular/router'; import { AdminService } from '@ghostfolio/client/services/admin.service'; import { DataService } from '@ghostfolio/client/services/data.service'; diff --git a/apps/client/src/app/components/admin-market-data/admin-market-data.module.ts b/apps/client/src/app/components/admin-market-data/admin-market-data.module.ts index 6db2de910..6991a2455 100644 --- a/apps/client/src/app/components/admin-market-data/admin-market-data.module.ts +++ b/apps/client/src/app/components/admin-market-data/admin-market-data.module.ts @@ -2,8 +2,8 @@ import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { MatMenuModule } from '@angular/material/menu'; -import { MatTableModule } from '@angular/material/table'; import { MatSortModule } from '@angular/material/sort'; +import { MatTableModule } from '@angular/material/table'; import { GfActivitiesFilterModule } from '@ghostfolio/ui/activities-filter/activities-filter.module'; import { AdminMarketDataComponent } from './admin-market-data.component'; diff --git a/apps/client/src/app/core/auth.interceptor.ts b/apps/client/src/app/core/auth.interceptor.ts index 5cbbbf868..22e2cce76 100644 --- a/apps/client/src/app/core/auth.interceptor.ts +++ b/apps/client/src/app/core/auth.interceptor.ts @@ -5,6 +5,8 @@ import { HttpRequest } from '@angular/common/http'; import { Injectable } from '@angular/core'; +import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; +import { TokenStorageService } from '@ghostfolio/client/services/token-storage.service'; import { HEADER_KEY_IMPERSONATION, HEADER_KEY_TIMEZONE, @@ -12,9 +14,6 @@ import { } from '@ghostfolio/common/config'; import { Observable } from 'rxjs'; -import { ImpersonationStorageService } from '../services/impersonation-storage.service'; -import { TokenStorageService } from '../services/token-storage.service'; - @Injectable() export class AuthInterceptor implements HttpInterceptor { public constructor( diff --git a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts index 63641644a..f0178f2f5 100644 --- a/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts +++ b/apps/client/src/app/pages/accounts/create-or-update-account-dialog/create-or-update-account-dialog.component.ts @@ -5,9 +5,9 @@ import { OnDestroy } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { DataService } from '@ghostfolio/client/services/data.service'; import { Subject } from 'rxjs'; -import { DataService } from '../../../services/data.service'; import { CreateOrUpdateAccountDialogParams } from './interfaces/interfaces'; @Component({ diff --git a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.module.ts b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.module.ts index 375d4582a..b83f72518 100644 --- a/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.module.ts +++ b/apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.module.ts @@ -5,9 +5,9 @@ import { MatAutocompleteModule } from '@angular/material/autocomplete'; import { MatButtonModule } from '@angular/material/button'; import { MatChipsModule } from '@angular/material/chips'; import { MatDatepickerModule } from '@angular/material/datepicker'; +import { MatDialogModule } from '@angular/material/dialog'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatInputModule } from '@angular/material/input'; -import { MatDialogModule } from '@angular/material/dialog'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { MatSelectModule } from '@angular/material/select'; import { GfSymbolModule } from '@ghostfolio/client/pipes/symbol/symbol.module'; diff --git a/apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.module.ts b/apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.module.ts index 16e89e69d..fdae625f9 100644 --- a/apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.module.ts +++ b/apps/client/src/app/pages/portfolio/activities/import-activities-dialog/import-activities-dialog.module.ts @@ -1,9 +1,9 @@ import { CommonModule } from '@angular/common'; import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { MatExpansionModule } from '@angular/material/expansion'; import { MatButtonModule } from '@angular/material/button'; import { MatDialogModule } from '@angular/material/dialog'; +import { MatExpansionModule } from '@angular/material/expansion'; import { MatFormFieldModule } from '@angular/material/form-field'; import { MatSelectModule } from '@angular/material/select'; import { GfDialogFooterModule } from '@ghostfolio/client/components/dialog-footer/dialog-footer.module';