-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
$null filter in relation not working #538
Comments
Hmm, unfortunately we don't have coverage for https://github.com/ppetzold/nestjs-paginate/blob/master/src/paginate.spec.ts#L697 Could you submit a PR with 2 test cases covering your examples? |
Let me know if this is what you expected, here's the PR: #539 |
is this still an issue with v6+ ? |
Yes, the issue persists. The problem arises from left joining the A workaround for now is to include I think the best way to fix this is for the |
hello guys, after an investigation, i found a solution that may work did someone noticed that because $not is not inside allowedOperations, the parseFilter never returns $not:$null? Line 350 in df69631
Expectedarray that includes the $not and $null combined find operator Actualempty array... by the way i'm using the line that ignores the $not is the following: Lines 277 to 279 in df69631
without that continue when suffix == "$not", it cames to here so...when adding a check if to not ignore the it does work properly db rows |
tldr: Lines 277 to 279 in df69631
- if (token.suffix && !allowedOperators.includes(token.suffix)) {
+ if (token.suffix && !allowedOperators.includes(token.suffix) && token.suffix !== "$not") { |
@daniel-maegerli, try this workaround:
filterableColumns: {
"diarios.id": [FilterOperator.EQ, FilterOperator.NULL, "$not"],
},
|
FilterSuffix.NOT make this works... this still an issue? if not, i think it should be better documentend. |
thats already on the docs, I didn't noticed |
Hi, I've been fiddling around with an issue for a while now, which looks like a bug to me. I want to filter on a relation's property "viewedAt" (which is datetime or NULL in the database) but cannot make it entirely work. Configuration (excerpt):
When I do a request with
&filter.matches.viewedAt=$null
everything gets delivered, no matter if the "viewedAt" is NULL or not.When I do a request with
&filter.matches.viewedAt=$not:$null
it actually delivers to correct items, having "viewedAt" set (although I haven't even set theFilterSuffix.NOT
in the configuration).Payload 1 (excerpt):
Payload 2 (excerpt):
Any idea? I've tried different versions and am on latest release (5.0.4) now. Still no luck to make it work.
The text was updated successfully, but these errors were encountered: