hasura / ra-data-hasura

react-admin data provider for Hasura GraphQL Engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

is FilterListItem corrent?

kulame opened this issue · comments

i try to filter by FilterListItem

import { FilterList, FilterListItem, FilterLiveSearch } from "react-admin";
<FilterListItem
          label="本日"
          value={{
            updated_at_gte: endOfYesterday().toISOString(),
            updated_at_lte: undefined,
          }}
        />

it generate where clause

{
	"where": {
		"_and": [
			{
				"updated_at_gte": {
					"_eq": "2022-04-20T15:59:59.999Z"
				}
			}
		]
	}
}

i think it will generate

{
	"where": {
		"_and": [
			{
				"updated_at": {
					"_gte": "2022-04-20T15:59:59.999Z"
				}
			}
		]
	}
}
commented

I guess that correct syntax for Hasura would be updated_at@_gte unlike example given in react-admin documentation page.

Thank you so much @daa !!!! Yes I can confirm updated_at@_gte generates the correct where clause:

    <FilterListItem
      label="本日"
      value={{
        'updated_at@_gte': endOfYesterday().toISOString(),
        'updated_at@_lte': undefined,
      }}
    />
{
    "where": {
        "_and": [
            {
                "updated_at": {
                    "_gte": "2022-04-29T04:59:59.999Z"
                }
            }
        ]
    },
    "limit": 10,
    "offset": 0,
    "order_by": {
        "id": "asc"
    }
}