nicgirault / express-crud-router

Simply expose resource CRUD (Create Read Update Delete) routes for Express & Sequelize. Compatible with React Admin Simple Rest Data Provider

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

implement FakeRest filters

fblinks opened this issue · comments

Hi,
I want to implement filters like the ones exposed by FakeRest, that should be the dialect used by React Admin Simple Rest Data Provider.
For example, if I pass the filter {"id_gt":100} I would like to have a query such as

SELECT * from x WHERE id > 100;

while now I get something like:

SELECT * from x WHERE id_gt = 100;

I'm not sure where and how I should implement those kind of filters

You can handle the logic in the get action:

app.use(
  crud('/admin/users', {
    get: ({ filter, limit, offset, order }) =>
      // do whatever you need with filter here
  })
)