league service

This commit is contained in:
2025-12-16 00:57:31 +01:00
parent 3b566c973d
commit 775d41e055
130 changed files with 4077 additions and 1036 deletions

View File

@@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { AnalyticsProviders, PAGE_VIEW_REPOSITORY_TOKEN, ENGAGEMENT_REPOSITORY_TOKEN } from './AnalyticsProviders';
@Module({
imports: [],
providers: AnalyticsProviders,
exports: [PAGE_VIEW_REPOSITORY_TOKEN, ENGAGEMENT_REPOSITORY_TOKEN],
})
export class AnalyticsModule {}

View File

@@ -0,0 +1,30 @@
import { Provider } from '@nestjs/common';
// Import core interfaces
import { IPageViewRepository } from '@gridpilot/analytics/application/repositories/IPageViewRepository';
import { IEngagementRepository } from '@gridpilot/analytics/domain/repositories/IEngagementRepository';
import { Logger } from '@gridpilot/shared/logging/Logger';
// Import implementations
import { InMemoryPageViewRepository } from '@gridpilot/adapters/analytics/persistence/inmemory/InMemoryPageViewRepository';
import { InMemoryEngagementRepository } from '@gridpilot/adapters/analytics/persistence/inmemory/InMemoryEngagementRepository';
// Import tokens
import { LOGGER_TOKEN } from '../logging/LoggingModule';
// Define injection tokens
export const PAGE_VIEW_REPOSITORY_TOKEN = Symbol('IPageViewRepository');
export const ENGAGEMENT_REPOSITORY_TOKEN = Symbol('IEngagementRepository');
export const AnalyticsProviders: Provider[] = [
{
provide: PAGE_VIEW_REPOSITORY_TOKEN,
useFactory: (logger: Logger) => new InMemoryPageViewRepository(logger),
inject: [LOGGER_TOKEN],
},
{
provide: ENGAGEMENT_REPOSITORY_TOKEN,
useFactory: (logger: Logger) => new InMemoryEngagementRepository(logger),
inject: [LOGGER_TOKEN],
},
];