import { Module } from '@nestjs/common'; import { LoggingModule } from '../../domain/logging/LoggingModule'; import type { Logger } from '@core/shared/domain/Logger'; import type { PageViewRepository } from '@core/analytics/application/repositories/PageViewRepository'; import type { AnalyticsSnapshotRepository } from '@core/analytics/domain/repositories/AnalyticsSnapshotRepository'; import type { EngagementRepository } from '@core/analytics/domain/repositories/EngagementRepository'; import { InMemoryAnalyticsSnapshotRepository } from '@adapters/analytics/persistence/inmemory/InMemoryAnalyticsSnapshotRepository'; import { InMemoryEngagementRepository } from '@adapters/analytics/persistence/inmemory/InMemoryEngagementRepository'; import { InMemoryPageViewRepository } from '@adapters/analytics/persistence/inmemory/InMemoryPageViewRepository'; import { ANALYTICS_ENGAGEMENT_REPOSITORY_TOKEN, ANALYTICS_PAGE_VIEW_REPOSITORY_TOKEN, ANALYTICS_SNAPSHOT_REPOSITORY_TOKEN, } from '../analytics/AnalyticsPersistenceTokens'; @Module({ imports: [LoggingModule], providers: [ { provide: ANALYTICS_PAGE_VIEW_REPOSITORY_TOKEN, useFactory: (logger: Logger): PageViewRepository => new InMemoryPageViewRepository(logger), inject: ['Logger'], }, { provide: ANALYTICS_ENGAGEMENT_REPOSITORY_TOKEN, useFactory: (logger: Logger): EngagementRepository => new InMemoryEngagementRepository(logger), inject: ['Logger'], }, { provide: ANALYTICS_SNAPSHOT_REPOSITORY_TOKEN, useFactory: (logger: Logger): AnalyticsSnapshotRepository => new InMemoryAnalyticsSnapshotRepository(logger), inject: ['Logger'], }, ], exports: [ ANALYTICS_PAGE_VIEW_REPOSITORY_TOKEN, ANALYTICS_ENGAGEMENT_REPOSITORY_TOKEN, ANALYTICS_SNAPSHOT_REPOSITORY_TOKEN, ], }) export class InMemoryAnalyticsPersistenceModule {}