@@ -83,26 +83,29 @@ private FilterQuery ParseFilterOperation(AttrAttribute attribute, string value)
83
83
if ( value . Length < 3 )
84
84
return new FilterQuery ( attribute , value , FilterOperations . eq ) ;
85
85
86
- var prefix = value . Substring ( 0 , 3 ) ;
86
+ var operation = value . Split ( ':' ) ;
87
87
88
- if ( prefix [ 2 ] != ':' )
88
+ if ( operation . Length == 1 )
89
89
return new FilterQuery ( attribute , value , FilterOperations . eq ) ;
90
90
91
91
// remove prefix from value
92
- value = value . Substring ( 3 , value . Length - 3 ) ;
92
+ var prefix = operation [ 0 ] ;
93
+ value = operation [ 1 ] ;
93
94
94
95
switch ( prefix )
95
96
{
96
- case "eq: " :
97
+ case "eq" :
97
98
return new FilterQuery ( attribute , value , FilterOperations . eq ) ;
98
- case "lt: " :
99
+ case "lt" :
99
100
return new FilterQuery ( attribute , value , FilterOperations . lt ) ;
100
- case "gt: " :
101
+ case "gt" :
101
102
return new FilterQuery ( attribute , value , FilterOperations . gt ) ;
102
- case "le: " :
103
+ case "le" :
103
104
return new FilterQuery ( attribute , value , FilterOperations . le ) ;
104
- case "ge: " :
105
+ case "ge" :
105
106
return new FilterQuery ( attribute , value , FilterOperations . ge ) ;
107
+ case "like" :
108
+ return new FilterQuery ( attribute , value , FilterOperations . like ) ;
106
109
}
107
110
108
111
throw new JsonApiException ( "400" , $ "Invalid filter prefix '{ prefix } '") ;
0 commit comments