Skip to content

Commit

Permalink
add support for nested fields filtering, fiix bug with null/'' dates (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Παναγιώτης Γεωργακόπουλος authored May 25, 2021
1 parent 5d5b507 commit 2ff0c86
Show file tree
Hide file tree
Showing 6 changed files with 23,655 additions and 2,601 deletions.
76 changes: 66 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@

A GraphQL data provider for [react-admin](https://marmelab.com/react-admin) tailored to target [Hasura](https://hasura.io/) GraphQL endpoints.

- [Installation](#installation)
- [Usage](#installation)
- [How It Works](#how-it-works)
- [Options](#options)
- [Apollo Client](#customize-the-apollo-client)
- [Authentication](#adding-authentication-headers)
- [Introspection](#customize-the-introspection)
- [Customizing queries](#customizing-queries)
- [Extending queries to related entities](#example-extending-a-query-to-include-related-entities)
- [Fully custom queries](#example-write-a-completely-custom-query)
- [ra-data-hasura](#ra-data-hasura)
- [Benefits and Motivation](#benefits-and-motivation)
- [Installation](#installation)
- [Usage](#usage)
- [How It Works](#how-it-works)
- [Options](#options)
- [Customize the Apollo client](#customize-the-apollo-client)
- [Adding Authentication Headers](#adding-authentication-headers)
- [Customize the introspection](#customize-the-introspection)
- [Customizing queries](#customizing-queries)
- [Example: extending a query to include related entities](#example-extending-a-query-to-include-related-entities)
- [Example: write a completely custom query](#example-write-a-completely-custom-query)
- [Special Filter Feature](#special-filter-feature)
- [Nested filtering](#nested-filtering)
- [Contributing](#contributing)
- [Credits](#credits)

Example applications demonstrating usage:

Expand Down Expand Up @@ -442,6 +448,56 @@ The adapter assigns default comparator depends on the data type if it is not pro
For string data types, it assumes as text search and uses `ilike` otherwise it uses `eq`.
For string data types that uses `like` or `ilike` it automatically transform the filter `value` as `%value%`.

### Nested filtering

Nested filtering is supported using # as a field separator.

```tsx
<TextInput
label="Search by indication, drug, sponsor, nctid"
source="indication#name@_ilike,drug#preferred_name@_ilike,sponsor#name@_ilike,trial#nctid@_ilike"
alwaysOn
/>
```

Will produce the following payload:

```json
{
"where": {
"_and": [],
"_or": [
{
"indication": {
"name": {
"_ilike": "%TEXT%"
}
}
},
{
"drug": {
"name": {
"_ilike": "%TEXT%"
}
}
},
{
"sponsor": {
"name": {
"_ilike": "%TEXT%"
}
}
}
]
},
"limit": 10,
"offset": 0,
"order_by": {
"id": "asc"
}
}
```

## Contributing

To modify, extend and test this package locally,
Expand Down
Loading

0 comments on commit 2ff0c86

Please sign in to comment.