2023-01-21 17:11:55 +01:00
|
|
|
import {
|
2023-02-25 15:12:03 +01:00
|
|
|
IAlbumRepository,
|
|
|
|
IAssetRepository,
|
|
|
|
ICommunicationRepository,
|
2023-01-21 17:11:55 +01:00
|
|
|
ICryptoRepository,
|
2023-05-17 19:07:17 +02:00
|
|
|
IFaceRepository,
|
2023-04-05 00:23:07 +02:00
|
|
|
IGeocodingRepository,
|
2023-01-21 17:11:55 +01:00
|
|
|
IJobRepository,
|
|
|
|
IKeyRepository,
|
2023-02-25 15:12:03 +01:00
|
|
|
IMachineLearningRepository,
|
|
|
|
IMediaRepository,
|
2023-03-28 18:29:20 +02:00
|
|
|
immichAppConfig,
|
2023-05-15 19:30:53 +02:00
|
|
|
IPartnerRepository,
|
2023-05-17 19:07:17 +02:00
|
|
|
IPersonRepository,
|
2023-03-03 03:47:08 +01:00
|
|
|
ISearchRepository,
|
2023-01-25 17:35:28 +01:00
|
|
|
ISharedLinkRepository,
|
2023-02-25 15:12:03 +01:00
|
|
|
ISmartInfoRepository,
|
2023-02-03 16:16:25 +01:00
|
|
|
IStorageRepository,
|
2023-01-21 17:11:55 +01:00
|
|
|
ISystemConfigRepository,
|
|
|
|
IUserRepository,
|
2023-02-25 15:12:03 +01:00
|
|
|
IUserTokenRepository,
|
2023-01-21 17:11:55 +01:00
|
|
|
} from '@app/domain';
|
|
|
|
import { BullModule } from '@nestjs/bull';
|
2023-01-12 03:34:36 +01:00
|
|
|
import { Global, Module, Provider } from '@nestjs/common';
|
2023-03-28 18:29:20 +02:00
|
|
|
import { ConfigModule } from '@nestjs/config';
|
2023-01-12 03:34:36 +01:00
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
2023-03-30 21:38:55 +02:00
|
|
|
import { CommunicationGateway } from './communication.gateway';
|
|
|
|
import { databaseConfig } from './database.config';
|
|
|
|
import { databaseEntities } from './entities';
|
|
|
|
import { bullConfig, bullQueues } from './infra.config';
|
2023-02-01 21:55:06 +01:00
|
|
|
import {
|
2023-02-25 15:12:03 +01:00
|
|
|
AlbumRepository,
|
2023-02-01 21:55:06 +01:00
|
|
|
APIKeyRepository,
|
2023-02-25 15:12:03 +01:00
|
|
|
AssetRepository,
|
2023-03-30 21:38:55 +02:00
|
|
|
CommunicationRepository,
|
|
|
|
CryptoRepository,
|
2023-05-17 19:07:17 +02:00
|
|
|
FaceRepository,
|
2023-03-30 21:38:55 +02:00
|
|
|
FilesystemProvider,
|
2023-04-05 00:23:07 +02:00
|
|
|
GeocodingRepository,
|
2023-03-30 21:38:55 +02:00
|
|
|
JobRepository,
|
|
|
|
MachineLearningRepository,
|
|
|
|
MediaRepository,
|
2023-05-15 19:30:53 +02:00
|
|
|
PartnerRepository,
|
2023-05-17 19:07:17 +02:00
|
|
|
PersonRepository,
|
2023-02-01 21:55:06 +01:00
|
|
|
SharedLinkRepository,
|
2023-02-25 15:12:03 +01:00
|
|
|
SmartInfoRepository,
|
2023-02-01 21:55:06 +01:00
|
|
|
SystemConfigRepository,
|
2023-03-30 21:38:55 +02:00
|
|
|
TypesenseRepository,
|
2023-02-01 21:55:06 +01:00
|
|
|
UserRepository,
|
2023-02-25 15:12:03 +01:00
|
|
|
UserTokenRepository,
|
2023-03-30 21:38:55 +02:00
|
|
|
} from './repositories';
|
2023-01-12 03:34:36 +01:00
|
|
|
|
|
|
|
const providers: Provider[] = [
|
2023-02-25 15:12:03 +01:00
|
|
|
{ provide: IAlbumRepository, useClass: AlbumRepository },
|
|
|
|
{ provide: IAssetRepository, useClass: AssetRepository },
|
|
|
|
{ provide: ICommunicationRepository, useClass: CommunicationRepository },
|
|
|
|
{ provide: ICryptoRepository, useClass: CryptoRepository },
|
2023-05-17 19:07:17 +02:00
|
|
|
{ provide: IFaceRepository, useClass: FaceRepository },
|
2023-04-05 00:23:07 +02:00
|
|
|
{ provide: IGeocodingRepository, useClass: GeocodingRepository },
|
2023-01-21 17:11:55 +01:00
|
|
|
{ provide: IJobRepository, useClass: JobRepository },
|
2023-04-05 00:23:07 +02:00
|
|
|
{ provide: IKeyRepository, useClass: APIKeyRepository },
|
2023-02-25 15:12:03 +01:00
|
|
|
{ provide: IMachineLearningRepository, useClass: MachineLearningRepository },
|
|
|
|
{ provide: IMediaRepository, useClass: MediaRepository },
|
2023-05-15 19:30:53 +02:00
|
|
|
{ provide: IPartnerRepository, useClass: PartnerRepository },
|
2023-05-17 19:07:17 +02:00
|
|
|
{ provide: IPersonRepository, useClass: PersonRepository },
|
2023-03-03 03:47:08 +01:00
|
|
|
{ provide: ISearchRepository, useClass: TypesenseRepository },
|
2023-01-25 17:35:28 +01:00
|
|
|
{ provide: ISharedLinkRepository, useClass: SharedLinkRepository },
|
2023-02-25 15:12:03 +01:00
|
|
|
{ provide: ISmartInfoRepository, useClass: SmartInfoRepository },
|
2023-02-03 16:16:25 +01:00
|
|
|
{ provide: IStorageRepository, useClass: FilesystemProvider },
|
2023-01-21 17:11:55 +01:00
|
|
|
{ provide: ISystemConfigRepository, useClass: SystemConfigRepository },
|
2023-01-12 03:34:36 +01:00
|
|
|
{ provide: IUserRepository, useClass: UserRepository },
|
2023-01-27 21:50:07 +01:00
|
|
|
{ provide: IUserTokenRepository, useClass: UserTokenRepository },
|
2023-01-12 03:34:36 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
@Global()
|
|
|
|
@Module({
|
|
|
|
imports: [
|
2023-03-28 18:29:20 +02:00
|
|
|
ConfigModule.forRoot(immichAppConfig),
|
2023-01-12 03:34:36 +01:00
|
|
|
TypeOrmModule.forRoot(databaseConfig),
|
2023-03-30 21:38:55 +02:00
|
|
|
TypeOrmModule.forFeature(databaseEntities),
|
|
|
|
BullModule.forRoot(bullConfig),
|
|
|
|
BullModule.registerQueue(...bullQueues),
|
2023-01-12 03:34:36 +01:00
|
|
|
],
|
2023-02-25 15:12:03 +01:00
|
|
|
providers: [...providers, CommunicationGateway],
|
2023-01-27 21:50:07 +01:00
|
|
|
exports: [...providers, BullModule],
|
2023-01-12 03:34:36 +01:00
|
|
|
})
|
|
|
|
export class InfraModule {}
|