gid-oss/dataui-nestjs-crud

QueryFilterFunction receives undefined for search

Closed this issue · 5 comments

This is an issue from the original repository but still relevant, so I am reposting the issue here.

Original issue: nestjsx#551

When declaring the filter option inside of the @Crud() decorator for a controller it is only working when provided as a static object. When I use the documented QueryFilterFunction, as described [in the docs (https://github.com/nestjsx/crud/wiki/Controllers#filter), the first parameter is receiving undefined and all filters are ignored.

I need to extend any incoming filters with some persisted filters based on the current date for the records. Using new Date() in the static object generates a matching static date-value and therefore breaks my intent. The solution makes sense to use a factory function to merge the search options, but so long as the incoming ```SCondition```` is empty that is impossible.

I'm using the latest releases for the following libraries.

"@nestjs/typeorm": "~7.1.0",
"@nestjsx/crud": "~4.6.2",
"@nestjsx/crud-typeorm": "~4.6.2",
"typeorm": "~0.2.25"

zaro commented

@LucusWebsites

"@nestjsx/crud": "~4.6.2",
"@nestjsx/crud-typeorm": "~4.6.2",

This repo is a fork under a different name so please try to reproduce with the packages from this repo and open the bug again if still occurring.

See here how to use the packages from this repo: https://github.com/gid-oss/dataui-nestjs-crud#install

Thank you for the reply.

I mixed @nestjsx/* packages with @dataui/* packages.

I removed the @nestjsx packages but the problem still occurs unfortunately.

"@dataui/crud": "5.3.1",
"@dataui/crud-request": "5.3.1",
"@dataui/crud-typeorm": "5.3.1",
"@nestjs/typeorm": "10.0.0",
"typeorm": "0.3.17",
zaro commented

Cheers, thanks for the quick reply!