File tree Expand file tree Collapse file tree 1 file changed +6
-21
lines changed
Expand file tree Collapse file tree 1 file changed +6
-21
lines changed Original file line number Diff line number Diff line change @@ -17,34 +17,19 @@ const codec = t.strict({
1717type RemoveArea = t . TypeOf < typeof codec > ;
1818
1919const process : Command < RemoveArea > [ 'process' ] = input => {
20- if ( input . events . length === 0 ) {
20+ if (
21+ input . events . length === 0 ||
22+ pipe ( input . events , RA . some ( isEventOfType ( 'AreaRemoved' ) ) )
23+ ) {
2124 return TE . left (
2225 failureWithStatus (
2326 'The requested area does not exist' ,
2427 StatusCodes . NOT_FOUND
2528 ) ( )
2629 ) ;
2730 }
28- return pipe (
29- pipe (
30- input . events ,
31- RA . filter ( isEventOfType ( 'AreaRemoved' ) ) ,
32- RA . match (
33- ( ) => O . some ( constructEvent ( 'AreaRemoved' ) ( input . command ) ) ,
34- ( ) => O . none
35- )
36- ) ,
37- O . match (
38- ( ) =>
39- TE . left (
40- failureWithStatus (
41- 'The requested area does not exist' ,
42- StatusCodes . NOT_FOUND
43- ) ( )
44- ) ,
45- event => TE . right ( O . some ( event ) )
46- )
47- ) ;
31+
32+ return TE . right ( O . some ( constructEvent ( 'AreaRemoved' ) ( input . command ) ) ) ;
4833} ;
4934
5035const resource : Command < RemoveArea > [ 'resource' ] = command => ( {
You can’t perform that action at this time.
0 commit comments