loopback-sdk-builder icon indicating copy to clipboard operation
loopback-sdk-builder copied to clipboard

Why aren't custom filters getting pick up in loopback?

Open jonathanwoahn opened this issue 6 years ago • 3 comments

What type of issue are you creating?

  • [X ] Bug
  • [ ] Enhancement
  • [ ] Question

What version of this module are you using?

  • [ ] 2.0.10 (Stable)
  • [ ] 2.1.0-rc.n (2.1 Release Candidate n)
  • [X ] Other (2.3.1)

Write other if any:

I've added a mixin to my loopback instance that handles a custom parameter in the filter object. However, it's not getting picked up from the Angular client. I've noticed the filter params are passed in the headers instead of a string in the query url--i'm guessing this has something to do with the reason it isn't working, but I'm kind of at a loss here. Any suggestions?

jonathanwoahn avatar Oct 16 '18 22:10 jonathanwoahn

I ended up writing a function in the API to check where the incoming filter object was coming from, and pull it from there. So that's working, but unfortunately the Angular SDK is expecting results on the "find" method to be returned as an array, so if I return it in any other format (i.e. object with some request metadata + the requested results) it's throwing an error.

First question is still open, but any suggestions on getting around that issue?

jonathanwoahn avatar Oct 17 '18 00:10 jonathanwoahn

@jonathanwoahn Change your remote method prefix find to something else, such as get

dreamdevil00 avatar Nov 15 '18 08:11 dreamdevil00

@jonathanwoahn Change your remote method prefix find to something else, such as get

Worked for me.

netishix avatar Mar 27 '20 13:03 netishix