inmemory to postgres

This commit is contained in:
2025-12-29 18:34:12 +01:00
parent 9e17d0752a
commit f5639a367f
176 changed files with 10175 additions and 468 deletions

View File

@@ -0,0 +1,46 @@
import { Module } from '@nestjs/common';
import { LoggingModule } from '../../domain/logging/LoggingModule';
import type { Logger } from '@core/shared/application/Logger';
import type { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
import type { IAnalyticsSnapshotRepository } from '@core/analytics/domain/repositories/IAnalyticsSnapshotRepository';
import type { IPageViewRepository } from '@core/analytics/application/repositories/IPageViewRepository';
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): IPageViewRepository => new InMemoryPageViewRepository(logger),
inject: ['Logger'],
},
{
provide: ANALYTICS_ENGAGEMENT_REPOSITORY_TOKEN,
useFactory: (logger: Logger): IEngagementRepository => new InMemoryEngagementRepository(logger),
inject: ['Logger'],
},
{
provide: ANALYTICS_SNAPSHOT_REPOSITORY_TOKEN,
useFactory: (logger: Logger): IAnalyticsSnapshotRepository => new InMemoryAnalyticsSnapshotRepository(logger),
inject: ['Logger'],
},
],
exports: [
ANALYTICS_PAGE_VIEW_REPOSITORY_TOKEN,
ANALYTICS_ENGAGEMENT_REPOSITORY_TOKEN,
ANALYTICS_SNAPSHOT_REPOSITORY_TOKEN,
],
})
export class InMemoryAnalyticsPersistenceModule {}