Steams / ra-data-hasura-graphql

React-admin data provider for Hasura GraphQL endpoints
MIT License
211 stars 33 forks source link

#44 Support Hasura (Postgres) text search types #50

Closed jasper95 closed 4 years ago

jasper95 commented 4 years ago

I tested it on my react-admin app

Screen Shot 2020-06-25 at 9 56 52 AM Screen Shot 2020-06-25 at 10 03 36 AM

Generated Payload

{
    "operationName": "user_accounts",
    "variables": {
        "where": {
            "_and": [],
            "_or": [{
                "email": {
                    "_ilike": "%edu%"
                }
            }, {
                "first_name": {
                    "_ilike": "%edu%"
                }
            }, {
                "last_name": {
                    "_ilike": "%edu%"
                }
            }]
        },
        "limit": 10,
        "offset": 0,
        "order_by": {
            "id": "asc"
        }
    },
    "query": "query user_accounts($limit: Int, $offset: Int, $order_by: [user_accounts_order_by!]!, $where: user_accounts_bool_exp) {\n  items: user_accounts(limit: $limit, offset: $offset, order_by: $order_by, where: $where) {\n    about_guest\n    about_guide\n    address1\n    address2\n    bikes\n    birthdate\n    city\n    country\n    created_at\n    email\n    enabled\n    first_name\n    gender\n    id\n    image_url\n    language_ids\n    last_name\n    miles_per_year\n    phone\n    photo_content_type\n    photo_file_name\n    photo_file_size\n    photo_updated_at\n    postal_code\n    region\n    riding_style\n    role\n    timezone\n    updated_at\n    years_riding\n    __typename\n  }\n  total: user_accounts_aggregate(order_by: $order_by, where: $where) {\n    aggregate {\n      count\n      __typename\n    }\n    __typename\n  }\n}\n"
}
cpursley commented 4 years ago

Can you also add to the adapter README on its usage similar to this: https://github.com/raphiniert-com/ra-data-postgrest#special-filter-feature

jasper95 commented 4 years ago

@cpursley Added README for filters

cpursley commented 4 years ago

@Steams can review (and merge if all looks good) when you have a moment?