first commit
This commit is contained in:
23
libs/api/shared/application/src/lib/shared.module.ts
Normal file
23
libs/api/shared/application/src/lib/shared.module.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { DynamicModule, Global, Module, Type } from '@nestjs/common';
|
||||
import { CqrsModule } from '@nestjs/cqrs';
|
||||
import { AggregateRehydrator } from './aggregate-rehydrator';
|
||||
|
||||
/**
|
||||
* Shared building blocks for every bounded context: the event store (from
|
||||
* the infrastructure module plugged in by the composition root) and the
|
||||
* AggregateRehydrator.
|
||||
*/
|
||||
@Global()
|
||||
@Module({})
|
||||
export class SharedModule {
|
||||
static withInfrastructure(
|
||||
infrastructureModule: Type | DynamicModule,
|
||||
): DynamicModule {
|
||||
return {
|
||||
module: SharedModule,
|
||||
imports: [CqrsModule, infrastructureModule],
|
||||
providers: [AggregateRehydrator],
|
||||
exports: [infrastructureModule, AggregateRehydrator],
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user