2023-01-21 17:11:55 +01:00
|
|
|
import {
|
2023-06-06 22:18:38 +02:00
|
|
|
IAccessRepository,
|
2023-11-01 04:13:34 +01:00
|
|
|
IActivityRepository,
|
2023-02-25 15:12:03 +01:00
|
|
|
IAlbumRepository,
|
|
|
|
IAssetRepository,
|
2023-08-24 21:28:50 +02:00
|
|
|
IAuditRepository,
|
2023-02-25 15:12:03 +01:00
|
|
|
ICommunicationRepository,
|
2023-01-21 17:11:55 +01:00
|
|
|
ICryptoRepository,
|
|
|
|
IJobRepository,
|
|
|
|
IKeyRepository,
|
2023-09-20 13:16:33 +02:00
|
|
|
ILibraryRepository,
|
2023-02-25 15:12:03 +01:00
|
|
|
IMachineLearningRepository,
|
|
|
|
IMediaRepository,
|
2023-09-27 20:44:51 +02:00
|
|
|
IMetadataRepository,
|
2023-10-11 04:14:44 +02:00
|
|
|
IMoveRepository,
|
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-10-24 17:05:42 +02:00
|
|
|
IServerInfoRepository,
|
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,
|
2023-11-25 19:53:30 +01:00
|
|
|
ISystemMetadataRepository,
|
2023-06-01 03:51:28 +02:00
|
|
|
ITagRepository,
|
2023-01-21 17:11:55 +01:00
|
|
|
IUserRepository,
|
2023-02-25 15:12:03 +01:00
|
|
|
IUserTokenRepository,
|
2023-09-27 20:44:51 +02:00
|
|
|
immichAppConfig,
|
2023-01-21 17:11:55 +01:00
|
|
|
} from '@app/domain';
|
2023-06-01 12:32:51 +02:00
|
|
|
import { BullModule } from '@nestjs/bullmq';
|
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-11-01 05:40:35 +01:00
|
|
|
import { ScheduleModule, SchedulerRegistry } from '@nestjs/schedule';
|
2023-01-12 03:34:36 +01:00
|
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
2023-03-30 21:38:55 +02:00
|
|
|
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-09-27 20:44:51 +02:00
|
|
|
APIKeyRepository,
|
2023-06-06 22:18:38 +02:00
|
|
|
AccessRepository,
|
2023-11-01 04:13:34 +01:00
|
|
|
ActivityRepository,
|
2023-02-25 15:12:03 +01:00
|
|
|
AlbumRepository,
|
|
|
|
AssetRepository,
|
2023-08-24 21:28:50 +02:00
|
|
|
AuditRepository,
|
2023-03-30 21:38:55 +02:00
|
|
|
CommunicationRepository,
|
|
|
|
CryptoRepository,
|
|
|
|
FilesystemProvider,
|
|
|
|
JobRepository,
|
2023-09-20 13:16:33 +02:00
|
|
|
LibraryRepository,
|
2023-03-30 21:38:55 +02:00
|
|
|
MachineLearningRepository,
|
|
|
|
MediaRepository,
|
2023-09-27 20:44:51 +02:00
|
|
|
MetadataRepository,
|
2023-10-11 04:14:44 +02:00
|
|
|
MoveRepository,
|
2023-05-15 19:30:53 +02:00
|
|
|
PartnerRepository,
|
2023-05-17 19:07:17 +02:00
|
|
|
PersonRepository,
|
2023-10-24 17:05:42 +02:00
|
|
|
ServerInfoRepository,
|
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-11-25 19:53:30 +01:00
|
|
|
SystemMetadataRepository,
|
2023-06-01 03:51:28 +02:00
|
|
|
TagRepository,
|
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-11-01 04:13:34 +01:00
|
|
|
{ provide: IActivityRepository, useClass: ActivityRepository },
|
2023-06-06 22:18:38 +02:00
|
|
|
{ provide: IAccessRepository, useClass: AccessRepository },
|
2023-02-25 15:12:03 +01:00
|
|
|
{ provide: IAlbumRepository, useClass: AlbumRepository },
|
|
|
|
{ provide: IAssetRepository, useClass: AssetRepository },
|
2023-08-24 21:28:50 +02:00
|
|
|
{ provide: IAuditRepository, useClass: AuditRepository },
|
2023-02-25 15:12:03 +01:00
|
|
|
{ provide: ICommunicationRepository, useClass: CommunicationRepository },
|
|
|
|
{ provide: ICryptoRepository, useClass: CryptoRepository },
|
2023-01-21 17:11:55 +01:00
|
|
|
{ provide: IJobRepository, useClass: JobRepository },
|
2023-09-20 13:16:33 +02:00
|
|
|
{ provide: ILibraryRepository, useClass: LibraryRepository },
|
2023-04-05 00:23:07 +02:00
|
|
|
{ provide: IKeyRepository, useClass: APIKeyRepository },
|
2023-02-25 15:12:03 +01:00
|
|
|
{ provide: IMachineLearningRepository, useClass: MachineLearningRepository },
|
2023-09-27 20:44:51 +02:00
|
|
|
{ provide: IMetadataRepository, useClass: MetadataRepository },
|
2023-10-11 04:14:44 +02:00
|
|
|
{ provide: IMoveRepository, useClass: MoveRepository },
|
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-10-24 17:05:42 +02:00
|
|
|
{ provide: IServerInfoRepository, useClass: ServerInfoRepository },
|
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-11-25 19:53:30 +01:00
|
|
|
{ provide: ISystemMetadataRepository, useClass: SystemMetadataRepository },
|
2023-06-01 03:51:28 +02:00
|
|
|
{ provide: ITagRepository, useClass: TagRepository },
|
2023-07-09 04:43:11 +02:00
|
|
|
{ provide: IMediaRepository, useClass: MediaRepository },
|
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-11-01 05:40:35 +01:00
|
|
|
SchedulerRegistry,
|
2023-01-12 03:34:36 +01:00
|
|
|
];
|
|
|
|
|
2023-10-06 23:32:28 +02:00
|
|
|
const imports = [
|
|
|
|
ConfigModule.forRoot(immichAppConfig),
|
|
|
|
TypeOrmModule.forRoot(databaseConfig),
|
|
|
|
TypeOrmModule.forFeature(databaseEntities),
|
2023-11-01 05:40:35 +01:00
|
|
|
ScheduleModule,
|
2023-10-06 23:32:28 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
const moduleExports = [...providers];
|
|
|
|
|
|
|
|
if (process.env.IMMICH_TEST_ENV !== 'true') {
|
|
|
|
imports.push(BullModule.forRoot(bullConfig));
|
|
|
|
imports.push(BullModule.registerQueue(...bullQueues));
|
|
|
|
moduleExports.push(BullModule);
|
|
|
|
}
|
|
|
|
|
2023-01-12 03:34:36 +01:00
|
|
|
@Global()
|
|
|
|
@Module({
|
2023-10-06 23:32:28 +02:00
|
|
|
imports,
|
2023-10-06 22:48:11 +02:00
|
|
|
providers: [...providers],
|
2023-10-06 23:32:28 +02:00
|
|
|
exports: moduleExports,
|
2023-01-12 03:34:36 +01:00
|
|
|
})
|
|
|
|
export class InfraModule {}
|