league service
This commit is contained in:
9
apps/website/lib/modules/analytics/AnalyticsModule.ts
Normal file
9
apps/website/lib/modules/analytics/AnalyticsModule.ts
Normal 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 {}
|
||||
30
apps/website/lib/modules/analytics/AnalyticsProviders.ts
Normal file
30
apps/website/lib/modules/analytics/AnalyticsProviders.ts
Normal 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],
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user