36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { Module } from '@nestjs/common';
|
|
|
|
import { LoggingModule } from '../../domain/logging/LoggingModule';
|
|
|
|
import type { Logger } from '@core/shared/application/Logger';
|
|
|
|
import type { IFeedRepository } from '@core/social/domain/repositories/IFeedRepository';
|
|
import type { ISocialGraphRepository } from '@core/social/domain/repositories/ISocialGraphRepository';
|
|
|
|
import {
|
|
InMemoryFeedRepository,
|
|
InMemorySocialGraphRepository,
|
|
} from '@adapters/social/persistence/inmemory/InMemorySocialAndFeed';
|
|
|
|
export const FEED_REPOSITORY_TOKEN = 'IFeedRepository';
|
|
export const SOCIAL_GRAPH_REPOSITORY_TOKEN = 'ISocialGraphRepository';
|
|
|
|
@Module({
|
|
imports: [LoggingModule],
|
|
providers: [
|
|
{
|
|
provide: FEED_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger): IFeedRepository =>
|
|
new InMemoryFeedRepository(logger, { drivers: [], friendships: [], feedEvents: [] }),
|
|
inject: ['Logger'],
|
|
},
|
|
{
|
|
provide: SOCIAL_GRAPH_REPOSITORY_TOKEN,
|
|
useFactory: (logger: Logger): ISocialGraphRepository =>
|
|
new InMemorySocialGraphRepository(logger, { drivers: [], friendships: [], feedEvents: [] }),
|
|
inject: ['Logger'],
|
|
},
|
|
],
|
|
exports: [FEED_REPOSITORY_TOKEN, SOCIAL_GRAPH_REPOSITORY_TOKEN],
|
|
})
|
|
export class InMemorySocialPersistenceModule {} |