Add task filter for lists
Signed-off-by: kolaente <k@knt.li>
This commit is contained in:
parent
03e4bf30c2
commit
8b485a3cd8
|
@ -188,10 +188,7 @@ func getValueForField(field reflect.StructField, rawValue string) (value interfa
|
|||
|
||||
func getNativeValueForTaskField(fieldName string, comparator taskFilterComparator, value string) (nativeValue interface{}, err error) {
|
||||
|
||||
var realFieldName = strcase.ToCamel(fieldName)
|
||||
if strings.ToLower(fieldName) == "id" {
|
||||
realFieldName = "ID"
|
||||
}
|
||||
realFieldName := strings.ReplaceAll(strcase.ToCamel(fieldName), "Id", "ID")
|
||||
|
||||
field, ok := reflect.TypeOf(&Task{}).Elem().FieldByName(realFieldName)
|
||||
if !ok {
|
||||
|
|
|
@ -941,6 +941,19 @@ func TestTaskCollection_ReadAll(t *testing.T) {
|
|||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "filter list",
|
||||
fields: fields{
|
||||
FilterBy: []string{"list_id"},
|
||||
FilterValue: []string{"6"},
|
||||
FilterComparator: []string{"equals"},
|
||||
},
|
||||
args: defaultArgs,
|
||||
want: []*Task{
|
||||
task15,
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
|
Loading…
Reference in New Issue
Block a user