File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1
- import { InputType } from '@nestjs/graphql' ;
1
+ import { Field , InputType } from '@nestjs/graphql' ;
2
2
import { DateTime } from 'luxon' ;
3
3
import { DateField , DateTimeField } from './luxon.graphql' ;
4
4
import { CalendarDate } from './temporal' ;
@@ -30,6 +30,9 @@ export abstract class DateFilter {
30
30
nullable : true ,
31
31
} )
32
32
beforeInclusive ?: CalendarDate ;
33
+
34
+ @Field ( { description : 'Whether the field is null or not' , nullable : true } )
35
+ isNull ?: boolean ;
33
36
}
34
37
35
38
@InputType ( {
@@ -59,4 +62,7 @@ export abstract class DateTimeFilter {
59
62
nullable : true ,
60
63
} )
61
64
beforeInclusive ?: DateTime ;
65
+
66
+ @Field ( { description : 'Whether the field is null or not' , nullable : true } )
67
+ isNull ?: boolean ;
62
68
}
Original file line number Diff line number Diff line change @@ -222,9 +222,13 @@ export const comparisonOfDateTimeFilter = (
222
222
after : comparisions . greaterThan ,
223
223
beforeInclusive : comparisions . lessEqualTo ,
224
224
before : comparisions . lessThan ,
225
+ isNull :
226
+ ( val : boolean | any ) : Comparator =>
227
+ ( _ , name ) =>
228
+ `${ name } ${ val ? 'IS' : 'IS NOT' } NULL` ,
225
229
} ;
226
230
const comparators = entries ( input ) . flatMap ( ( [ key , val ] ) =>
227
- val ? comparatorMap [ key ] ( val ) : [ ] ,
231
+ val != null ? comparatorMap [ key ] ( val ) : [ ] ,
228
232
) ;
229
233
return comparators . length > 0
230
234
? ( ...args ) => comparators . map ( ( comp ) => comp ( ...args ) ) . join ( ' AND ' )
You can’t perform that action at this time.
0 commit comments