30 lines
1.2 KiB
TypeScript
30 lines
1.2 KiB
TypeScript
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],
|
|
},
|
|
]; |