marmelab / ra-supabase

Supabase adapter for react-admin, the frontend framework for building admin applications on top of REST/GraphQL services.
MIT License
141 stars 26 forks source link

Using useGetList with a neq suffix causes an error #12

Closed samhinchcliffeapk closed 2 years ago

samhinchcliffeapk commented 2 years ago

Taking the example from your demo in DealsPipeline.tsx

const { data, ids: unorderedIds, total, loaded } = useGetList<Deal>(
        'deals',
        { page: 1, perPage: 10 },
        { field: 'last_seen', order: 'DESC' },
        { stage_neq: 'lost', sales_id: identity?.id },
        { enabled: Number.isInteger(identity?.id) }
    );

When the request is made I get a 400 response with the error message: "column deals.stage_neq does not exist"

Have I misunderstood this or is this an issue?

s-graber commented 2 years ago

I also have this issue with _gt or _lt.

fzaninotto commented 2 years ago

Hi,

The handling of conditions other than equality on filters is nowhere near standardized, and react-admin doesn't try to force any way to do it.

The code you copied from the demo works with the demo API (powered by FakeRest), but probably not with another API. It's up to you to implement it on the server-side, or to use another syntax supported by your API.