import { Module } from '@nestjs/common'; import { LoggingModule } from '../../domain/logging/LoggingModule'; import type { Logger } from '@core/shared/domain/Logger'; import type { AvatarGenerationRepository } from '@core/media/domain/repositories/AvatarGenerationRepository'; import type { AvatarRepository } from '@core/media/domain/repositories/AvatarRepository'; import type { MediaRepository } from '@core/media/domain/repositories/MediaRepository'; import { InMemoryAvatarGenerationRepository } from '@adapters/media/persistence/inmemory/InMemoryAvatarGenerationRepository'; import { AVATAR_GENERATION_REPOSITORY_TOKEN, AVATAR_REPOSITORY_TOKEN, MEDIA_REPOSITORY_TOKEN } from '../media/MediaPersistenceTokens'; // Mock implementations for Media and Avatar repositories (inmemory only has AvatarGeneration) class MockMediaRepository implements MediaRepository { async save(): Promise {} async findById(): Promise { return null; } async findByUploadedBy(): Promise<[]> { return []; } async delete(): Promise {} } class MockAvatarRepository implements AvatarRepository { async save(): Promise {} async findById(): Promise { return null; } async findActiveByDriverId(): Promise { return null; } async findByDriverId(): Promise<[]> { return []; } async delete(): Promise {} } @Module({ imports: [LoggingModule], providers: [ { provide: AVATAR_GENERATION_REPOSITORY_TOKEN, useFactory: (logger: Logger): AvatarGenerationRepository => new InMemoryAvatarGenerationRepository(logger), inject: ['Logger'], }, { provide: MEDIA_REPOSITORY_TOKEN, useClass: MockMediaRepository, }, { provide: AVATAR_REPOSITORY_TOKEN, useClass: MockAvatarRepository, }, ], exports: [AVATAR_GENERATION_REPOSITORY_TOKEN, MEDIA_REPOSITORY_TOKEN, AVATAR_REPOSITORY_TOKEN], }) export class InMemoryMediaPersistenceModule {}