Browse Source

Feature/restructure api modules (#706)

* Restructure modules

* Update changelog
pull/701/head
Thomas Kaul 3 years ago
committed by GitHub
parent
commit
baa6a3d0f0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      CHANGELOG.md
  2. 6
      apps/api/src/app/access/access.module.ts
  3. 10
      apps/api/src/app/auth-device/auth-device.module.ts
  4. 8
      apps/api/src/app/auth/auth.module.ts
  5. 17
      apps/api/src/app/cache/cache.module.ts
  6. 7
      apps/api/src/app/import/import.module.ts
  7. 16
      apps/api/src/app/info/info.module.ts
  8. 9
      apps/api/src/app/order/order.module.ts
  9. 2
      apps/api/src/app/portfolio/portfolio.module.ts
  10. 6
      apps/api/src/app/redis-cache/redis-cache.module.ts
  11. 10
      apps/api/src/app/subscription/subscription.module.ts
  12. 12
      apps/api/src/app/user/user.module.ts

1
CHANGELOG.md

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Moved the countries and sectors charts in the position detail dialog - Moved the countries and sectors charts in the position detail dialog
- Restructured the server modules
## 1.116.0 - 16.02.2022 ## 1.116.0 - 16.02.2022

6
apps/api/src/app/access/access.module.ts

@ -1,4 +1,4 @@
import { PrismaService } from '@ghostfolio/api/services/prisma.service'; import { PrismaModule } from '@ghostfolio/api/services/prisma.module';
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { AccessController } from './access.controller'; import { AccessController } from './access.controller';
@ -7,7 +7,7 @@ import { AccessService } from './access.service';
@Module({ @Module({
controllers: [AccessController], controllers: [AccessController],
exports: [AccessService], exports: [AccessService],
imports: [], imports: [PrismaModule],
providers: [AccessService, PrismaService] providers: [AccessService]
}) })
export class AccessModule {} export class AccessModule {}

10
apps/api/src/app/auth-device/auth-device.module.ts

@ -1,18 +1,20 @@
import { AuthDeviceController } from '@ghostfolio/api/app/auth-device/auth-device.controller'; import { AuthDeviceController } from '@ghostfolio/api/app/auth-device/auth-device.controller';
import { AuthDeviceService } from '@ghostfolio/api/app/auth-device/auth-device.service'; import { AuthDeviceService } from '@ghostfolio/api/app/auth-device/auth-device.service';
import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module';
import { PrismaService } from '@ghostfolio/api/services/prisma.service'; import { PrismaModule } from '@ghostfolio/api/services/prisma.module';
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt'; import { JwtModule } from '@nestjs/jwt';
@Module({ @Module({
controllers: [AuthDeviceController], controllers: [AuthDeviceController],
imports: [ imports: [
ConfigurationModule,
JwtModule.register({ JwtModule.register({
secret: process.env.JWT_SECRET_KEY, secret: process.env.JWT_SECRET_KEY,
signOptions: { expiresIn: '180 days' } signOptions: { expiresIn: '180 days' }
}) }),
PrismaModule
], ],
providers: [AuthDeviceService, ConfigurationService, PrismaService] providers: [AuthDeviceService]
}) })
export class AuthDeviceModule {} export class AuthDeviceModule {}

8
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 { WebAuthService } from '@ghostfolio/api/app/auth/web-auth.service';
import { SubscriptionModule } from '@ghostfolio/api/app/subscription/subscription.module'; import { SubscriptionModule } from '@ghostfolio/api/app/subscription/subscription.module';
import { UserModule } from '@ghostfolio/api/app/user/user.module'; import { UserModule } from '@ghostfolio/api/app/user/user.module';
import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module';
import { PrismaService } from '@ghostfolio/api/services/prisma.service'; import { PrismaModule } from '@ghostfolio/api/services/prisma.module';
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt'; import { JwtModule } from '@nestjs/jwt';
@ -15,20 +15,20 @@ import { JwtStrategy } from './jwt.strategy';
@Module({ @Module({
controllers: [AuthController], controllers: [AuthController],
imports: [ imports: [
ConfigurationModule,
JwtModule.register({ JwtModule.register({
secret: process.env.JWT_SECRET_KEY, secret: process.env.JWT_SECRET_KEY,
signOptions: { expiresIn: '180 days' } signOptions: { expiresIn: '180 days' }
}), }),
PrismaModule,
SubscriptionModule, SubscriptionModule,
UserModule UserModule
], ],
providers: [ providers: [
AuthDeviceService, AuthDeviceService,
AuthService, AuthService,
ConfigurationService,
GoogleStrategy, GoogleStrategy,
JwtStrategy, JwtStrategy,
PrismaService,
WebAuthService WebAuthService
] ]
}) })

17
apps/api/src/app/cache/cache.module.ts

@ -1,30 +1,27 @@
import { CacheService } from '@ghostfolio/api/app/cache/cache.service'; import { CacheService } from '@ghostfolio/api/app/cache/cache.service';
import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module'; import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module';
import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module';
import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module'; import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module';
import { DataGatheringService } from '@ghostfolio/api/services/data-gathering.service';
import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module';
import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module'; import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module';
import { PrismaService } from '@ghostfolio/api/services/prisma.service'; import { PrismaModule } from '@ghostfolio/api/services/prisma.module';
import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile.module'; import { SymbolProfileModule } from '@ghostfolio/api/services/symbol-profile.module';
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { CacheController } from './cache.controller'; import { CacheController } from './cache.controller';
@Module({ @Module({
exports: [CacheService],
controllers: [CacheController],
imports: [ imports: [
ConfigurationModule,
DataGatheringModule, DataGatheringModule,
DataProviderModule, DataProviderModule,
ExchangeRateDataModule, ExchangeRateDataModule,
PrismaModule,
RedisCacheModule, RedisCacheModule,
SymbolProfileModule SymbolProfileModule
], ],
controllers: [CacheController], providers: [CacheService]
providers: [
CacheService,
ConfigurationService,
DataGatheringService,
PrismaService
]
}) })
export class CacheModule {} export class CacheModule {}

7
apps/api/src/app/import/import.module.ts

@ -1,4 +1,4 @@
import { CacheService } from '@ghostfolio/api/app/cache/cache.service'; import { CacheModule } from '@ghostfolio/api/app/cache/cache.module';
import { OrderModule } from '@ghostfolio/api/app/order/order.module'; import { OrderModule } from '@ghostfolio/api/app/order/order.module';
import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module'; import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module';
import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module'; import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module';
@ -11,7 +11,9 @@ import { ImportController } from './import.controller';
import { ImportService } from './import.service'; import { ImportService } from './import.service';
@Module({ @Module({
controllers: [ImportController],
imports: [ imports: [
CacheModule,
ConfigurationModule, ConfigurationModule,
DataGatheringModule, DataGatheringModule,
DataProviderModule, DataProviderModule,
@ -19,7 +21,6 @@ import { ImportService } from './import.service';
PrismaModule, PrismaModule,
RedisCacheModule RedisCacheModule
], ],
controllers: [ImportController], providers: [ImportService]
providers: [CacheService, ImportService]
}) })
export class ImportModule {} export class ImportModule {}

16
apps/api/src/app/info/info.module.ts

@ -1,10 +1,9 @@
import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module'; import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module';
import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module';
import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module'; import { DataGatheringModule } from '@ghostfolio/api/services/data-gathering.module';
import { DataGatheringService } from '@ghostfolio/api/services/data-gathering.service';
import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module'; import { DataProviderModule } from '@ghostfolio/api/services/data-provider/data-provider.module';
import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module'; import { ExchangeRateDataModule } from '@ghostfolio/api/services/exchange-rate-data.module';
import { PrismaService } from '@ghostfolio/api/services/prisma.service'; import { PrismaModule } from '@ghostfolio/api/services/prisma.module';
import { PropertyModule } from '@ghostfolio/api/services/property/property.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.module';
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
@ -14,7 +13,9 @@ import { InfoController } from './info.controller';
import { InfoService } from './info.service'; import { InfoService } from './info.service';
@Module({ @Module({
controllers: [InfoController],
imports: [ imports: [
ConfigurationModule,
DataGatheringModule, DataGatheringModule,
DataProviderModule, DataProviderModule,
ExchangeRateDataModule, ExchangeRateDataModule,
@ -22,16 +23,11 @@ import { InfoService } from './info.service';
secret: process.env.JWT_SECRET_KEY, secret: process.env.JWT_SECRET_KEY,
signOptions: { expiresIn: '30 days' } signOptions: { expiresIn: '30 days' }
}), }),
PrismaModule,
PropertyModule, PropertyModule,
RedisCacheModule, RedisCacheModule,
SymbolProfileModule SymbolProfileModule
], ],
controllers: [InfoController], providers: [InfoService]
providers: [
ConfigurationService,
DataGatheringService,
InfoService,
PrismaService
]
}) })
export class InfoModule {} export class InfoModule {}

9
apps/api/src/app/order/order.module.ts

@ -1,5 +1,5 @@
import { AccountService } from '@ghostfolio/api/app/account/account.service'; import { AccountService } from '@ghostfolio/api/app/account/account.service';
import { CacheService } from '@ghostfolio/api/app/cache/cache.service'; import { CacheModule } from '@ghostfolio/api/app/cache/cache.module';
import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module'; import { RedisCacheModule } from '@ghostfolio/api/app/redis-cache/redis-cache.module';
import { UserModule } from '@ghostfolio/api/app/user/user.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.module';
@ -15,7 +15,10 @@ import { OrderController } from './order.controller';
import { OrderService } from './order.service'; import { OrderService } from './order.service';
@Module({ @Module({
controllers: [OrderController],
exports: [OrderService],
imports: [ imports: [
CacheModule,
ConfigurationModule, ConfigurationModule,
DataGatheringModule, DataGatheringModule,
DataProviderModule, DataProviderModule,
@ -26,8 +29,6 @@ import { OrderService } from './order.service';
SymbolProfileModule, SymbolProfileModule,
UserModule UserModule
], ],
controllers: [OrderController], providers: [AccountService, OrderService]
providers: [AccountService, CacheService, OrderService],
exports: [OrderService]
}) })
export class OrderModule {} export class OrderModule {}

2
apps/api/src/app/portfolio/portfolio.module.ts

@ -20,6 +20,7 @@ import { PortfolioServiceNew } from './portfolio.service-new';
import { RulesService } from './rules.service'; import { RulesService } from './rules.service';
@Module({ @Module({
controllers: [PortfolioController],
exports: [PortfolioServiceStrategy], exports: [PortfolioServiceStrategy],
imports: [ imports: [
AccessModule, AccessModule,
@ -34,7 +35,6 @@ import { RulesService } from './rules.service';
SymbolProfileModule, SymbolProfileModule,
UserModule UserModule
], ],
controllers: [PortfolioController],
providers: [ providers: [
AccountService, AccountService,
CurrentRateService, CurrentRateService,

6
apps/api/src/app/redis-cache/redis-cache.module.ts

@ -1,3 +1,4 @@
import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module';
import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; import { ConfigurationService } from '@ghostfolio/api/services/configuration.service';
import { CacheModule, Module } from '@nestjs/common'; import { CacheModule, Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config'; import { ConfigModule, ConfigService } from '@nestjs/config';
@ -17,9 +18,10 @@ import { RedisCacheService } from './redis-cache.service';
store: redisStore, store: redisStore,
ttl: configurationService.get('CACHE_TTL') ttl: configurationService.get('CACHE_TTL')
}) })
}) }),
ConfigurationModule
], ],
providers: [ConfigurationService, RedisCacheService], providers: [RedisCacheService],
exports: [RedisCacheService] exports: [RedisCacheService]
}) })
export class RedisCacheModule {} export class RedisCacheModule {}

10
apps/api/src/app/subscription/subscription.module.ts

@ -1,5 +1,5 @@
import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module';
import { PrismaService } from '@ghostfolio/api/services/prisma.service'; import { PrismaModule } from '@ghostfolio/api/services/prisma.module';
import { PropertyModule } from '@ghostfolio/api/services/property/property.module'; import { PropertyModule } from '@ghostfolio/api/services/property/property.module';
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
@ -7,9 +7,9 @@ import { SubscriptionController } from './subscription.controller';
import { SubscriptionService } from './subscription.service'; import { SubscriptionService } from './subscription.service';
@Module({ @Module({
imports: [PropertyModule],
controllers: [SubscriptionController], controllers: [SubscriptionController],
providers: [ConfigurationService, PrismaService, SubscriptionService], exports: [SubscriptionService],
exports: [SubscriptionService] imports: [ConfigurationModule, PrismaModule, PropertyModule],
providers: [SubscriptionService]
}) })
export class SubscriptionModule {} export class SubscriptionModule {}

12
apps/api/src/app/user/user.module.ts

@ -1,6 +1,6 @@
import { SubscriptionModule } from '@ghostfolio/api/app/subscription/subscription.module'; import { SubscriptionModule } from '@ghostfolio/api/app/subscription/subscription.module';
import { ConfigurationService } from '@ghostfolio/api/services/configuration.service'; import { ConfigurationModule } from '@ghostfolio/api/services/configuration.module';
import { PrismaService } from '@ghostfolio/api/services/prisma.service'; import { PrismaModule } from '@ghostfolio/api/services/prisma.module';
import { PropertyModule } from '@ghostfolio/api/services/property/property.module'; import { PropertyModule } from '@ghostfolio/api/services/property/property.module';
import { Module } from '@nestjs/common'; import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt'; import { JwtModule } from '@nestjs/jwt';
@ -9,16 +9,18 @@ import { UserController } from './user.controller';
import { UserService } from './user.service'; import { UserService } from './user.service';
@Module({ @Module({
controllers: [UserController],
exports: [UserService],
imports: [ imports: [
ConfigurationModule,
JwtModule.register({ JwtModule.register({
secret: process.env.JWT_SECRET_KEY, secret: process.env.JWT_SECRET_KEY,
signOptions: { expiresIn: '30 days' } signOptions: { expiresIn: '30 days' }
}), }),
PrismaModule,
PropertyModule, PropertyModule,
SubscriptionModule SubscriptionModule
], ],
controllers: [UserController], providers: [UserService]
providers: [ConfigurationService, PrismaService, UserService],
exports: [UserService]
}) })
export class UserModule {} export class UserModule {}

Loading…
Cancel
Save