mirror of
https://github.com/immich-app/immich.git
synced 2025-01-09 13:26:47 +01:00
cc2dc12f6c
* run migrations after checks * optional migrations * only run checks in server and e2e * re-add migrations for microservices * refactor * move e2e init * remove assert from migration * update providers * update microservices app service * fixed logging * refactored version check, added unit tests * more version tests * don't use mocks for sut * refactor tests * suggest image only if postgres is 14, 15 or 16 * review suggestions * fixed regexp escape * fix typing * update migration
119 lines
3.9 KiB
TypeScript
119 lines
3.9 KiB
TypeScript
import {
|
|
IAccessRepository,
|
|
IActivityRepository,
|
|
IAlbumRepository,
|
|
IAssetRepository,
|
|
IAuditRepository,
|
|
ICommunicationRepository,
|
|
ICryptoRepository,
|
|
IDatabaseRepository,
|
|
IJobRepository,
|
|
IKeyRepository,
|
|
ILibraryRepository,
|
|
IMachineLearningRepository,
|
|
IMediaRepository,
|
|
IMetadataRepository,
|
|
IMoveRepository,
|
|
IPartnerRepository,
|
|
IPersonRepository,
|
|
IServerInfoRepository,
|
|
ISharedLinkRepository,
|
|
ISmartInfoRepository,
|
|
IStorageRepository,
|
|
ISystemConfigRepository,
|
|
ISystemMetadataRepository,
|
|
ITagRepository,
|
|
IUserRepository,
|
|
IUserTokenRepository,
|
|
immichAppConfig,
|
|
} from '@app/domain';
|
|
import { BullModule } from '@nestjs/bullmq';
|
|
import { Global, Module, Provider } from '@nestjs/common';
|
|
import { ConfigModule } from '@nestjs/config';
|
|
import { ScheduleModule, SchedulerRegistry } from '@nestjs/schedule';
|
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
|
import { databaseConfig } from './database.config';
|
|
import { databaseEntities } from './entities';
|
|
import { bullConfig, bullQueues } from './infra.config';
|
|
import {
|
|
AccessRepository,
|
|
ActivityRepository,
|
|
AlbumRepository,
|
|
ApiKeyRepository,
|
|
AssetRepository,
|
|
AuditRepository,
|
|
CommunicationRepository,
|
|
CryptoRepository,
|
|
DatabaseRepository,
|
|
FilesystemProvider,
|
|
JobRepository,
|
|
LibraryRepository,
|
|
MachineLearningRepository,
|
|
MediaRepository,
|
|
MetadataRepository,
|
|
MoveRepository,
|
|
PartnerRepository,
|
|
PersonRepository,
|
|
ServerInfoRepository,
|
|
SharedLinkRepository,
|
|
SmartInfoRepository,
|
|
SystemConfigRepository,
|
|
SystemMetadataRepository,
|
|
TagRepository,
|
|
UserRepository,
|
|
UserTokenRepository,
|
|
} from './repositories';
|
|
|
|
const providers: Provider[] = [
|
|
{ provide: IActivityRepository, useClass: ActivityRepository },
|
|
{ provide: IAccessRepository, useClass: AccessRepository },
|
|
{ provide: IAlbumRepository, useClass: AlbumRepository },
|
|
{ provide: IAssetRepository, useClass: AssetRepository },
|
|
{ provide: IAuditRepository, useClass: AuditRepository },
|
|
{ provide: ICommunicationRepository, useClass: CommunicationRepository },
|
|
{ provide: ICryptoRepository, useClass: CryptoRepository },
|
|
{ provide: IDatabaseRepository, useClass: DatabaseRepository },
|
|
{ provide: IJobRepository, useClass: JobRepository },
|
|
{ provide: ILibraryRepository, useClass: LibraryRepository },
|
|
{ provide: IKeyRepository, useClass: ApiKeyRepository },
|
|
{ provide: IMachineLearningRepository, useClass: MachineLearningRepository },
|
|
{ provide: IMetadataRepository, useClass: MetadataRepository },
|
|
{ provide: IMoveRepository, useClass: MoveRepository },
|
|
{ provide: IPartnerRepository, useClass: PartnerRepository },
|
|
{ provide: IPersonRepository, useClass: PersonRepository },
|
|
{ provide: IServerInfoRepository, useClass: ServerInfoRepository },
|
|
{ provide: ISharedLinkRepository, useClass: SharedLinkRepository },
|
|
{ provide: ISmartInfoRepository, useClass: SmartInfoRepository },
|
|
{ provide: IStorageRepository, useClass: FilesystemProvider },
|
|
{ provide: ISystemConfigRepository, useClass: SystemConfigRepository },
|
|
{ provide: ISystemMetadataRepository, useClass: SystemMetadataRepository },
|
|
{ provide: ITagRepository, useClass: TagRepository },
|
|
{ provide: IMediaRepository, useClass: MediaRepository },
|
|
{ provide: IUserRepository, useClass: UserRepository },
|
|
{ provide: IUserTokenRepository, useClass: UserTokenRepository },
|
|
SchedulerRegistry,
|
|
];
|
|
|
|
const imports = [
|
|
ConfigModule.forRoot(immichAppConfig),
|
|
TypeOrmModule.forRoot(databaseConfig),
|
|
TypeOrmModule.forFeature(databaseEntities),
|
|
ScheduleModule,
|
|
];
|
|
|
|
const moduleExports = [...providers];
|
|
|
|
if (process.env.IMMICH_TEST_ENV !== 'true') {
|
|
// Currently not running e2e tests, set up redis and bull queues
|
|
imports.push(BullModule.forRoot(bullConfig));
|
|
imports.push(BullModule.registerQueue(...bullQueues));
|
|
moduleExports.push(BullModule);
|
|
}
|
|
|
|
@Global()
|
|
@Module({
|
|
imports,
|
|
providers: [...providers],
|
|
exports: moduleExports,
|
|
})
|
|
export class InfraModule {}
|