Open H4ad opened 3 years ago
I suggest to edit the archive on node_modules and use the patch-package. Work like a charm to me.
@jodaltro It's not necessary, just change the extended class to the one I put in the description, your solution is only needed when you have some library that uses nestjsx/crud.
The error that typeorm throws is:
syntax error at or near \":\"
.This problem happens with versions of typeorm above
~0.2.25
, I have two microservices, one with~0.2.25
which are ok and one with~0.2.36
which generate the error.The Problem
Using the following object as the value for the
s
query parameter:The query generated by lib is:
The problem lies in where filters:
WHERE \"perk\".\"name\" LIKE :andWhereperk.name17025429645493
, maybe the typeorm changes the behavior of how parameter names are parsed in versions above~0.2.25
which cannot parse when using filters likeperk.name
.Possible Solution
I read the library source code and found this method called builderSetWhere and I put the following line of code:
The solution strip the
.
dot in the field name by changing it to_
and now the filter works.For who having the problem
Until the issue is fixed, I create the following service to extend the
TypeOrmCrudService
instead:And instead it extends from
TypeOrmCrudService
, we will extends fromTypeOrmCrudServiceWithSupportForJoins
until the problem is fixed.Edit: I found this issue #728, looks related and fixes the bug I'm reporting. Edit2: The same author of this PR is the author of other PR Typeorm#8081 that introduces the bug in this library.