Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 20 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { Injectable } from '@nestjs/common'; |
||
2 | import { Observable } from 'rxjs'; |
||
3 | import { ICommand, ofType, Saga } from '@nestjs/cqrs'; |
||
4 | import { map } from 'rxjs/operators'; |
||
5 | import { SagaEvent } from '../events/test.events'; |
||
6 | import { TrySagaCommand } from '../commands/try.saga.command'; |
||
7 | |||
8 | @Injectable() |
||
9 | export class TrySagaHandler { |
||
10 | @Saga() |
||
11 | dragonKilled = (events$: Observable<any>): Observable<ICommand> => { |
||
12 | return events$.pipe( |
||
13 | ofType(SagaEvent), |
||
14 | map((event: SagaEvent) => { |
||
15 | return new TrySagaCommand(event.message); |
||
16 | }), |
||
17 | ); |
||
18 | } |
||
19 | } |
||
20 |