Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 29 |
Function Count | 2 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | /* tslint:disable:max-classes-per-file */ |
||
2 | import { EventsHandler, IEventHandler } from '@nestjs/cqrs'; |
||
3 | import { Storage } from '../storage/storage'; |
||
4 | import { SagaEvent, TryAggregateRootEvent } from '../events/test.events'; |
||
5 | |||
6 | @EventsHandler(TryAggregateRootEvent) |
||
7 | export class TryAggregateRootEventHandler implements IEventHandler<TryAggregateRootEvent> { |
||
8 | constructor( |
||
9 | private readonly storage: Storage |
||
10 | ) { |
||
11 | } |
||
12 | |||
13 | handle(event: TryAggregateRootEvent) { |
||
14 | this.storage.upsert('TryAggregateRootEvent', event.message); |
||
15 | } |
||
16 | } |
||
17 | |||
18 | @EventsHandler(SagaEvent) |
||
19 | export class SagaEventHandler implements IEventHandler<SagaEvent> { |
||
20 | constructor( |
||
21 | private readonly storage: Storage |
||
22 | ) { |
||
23 | } |
||
24 | |||
25 | handle(event: SagaEvent) { |
||
26 | this.storage.upsert('SagaEventHandler', event.message); |
||
27 | } |
||
28 | } |
||
29 |