jsonapify icon indicating copy to clipboard operation
jsonapify copied to clipboard

Provide example usage for transaction filters

Open brianreese opened this issue 7 years ago • 2 comments

Hi, Can you add a transaction filter example to the readme, or point me in the direction of an example of how they should be used? I've been unable to figure out so far how to add pagination or sorting when using jsonapify.enumerate.

brianreese avatar Feb 04 '17 16:02 brianreese

Each middleware accepts an options object as an optional argument. You can provide your transaction filters as jsonapify.enumerate('YourModel', { filters: [yourFilters] });. There's no documentation yet because we were considering adding an option for configurable global default filters via the Runtime class, but we have not decided on the definitive semantics yet.

alex94cp avatar Feb 13 '17 22:02 alex94cp

Thanks for this, that gives me enough to work with regarding filters. I also see now that there are some filters enabled by default in the enumerate middleware, when none are provided.

It seems, however, that when I try and use the default paginateOffset filter, supplying something like ?page[offset]=0&page[limit]=10, I get an error stating that the "'skip' field must be numeric" (and I can see from the message that my "0" and "10" were parsed as strings) -- Is this possibly user error? I can certainly dig a little and see if I can determine why this happens for me.

brianreese avatar Mar 21 '17 20:03 brianreese