nestjs-typeorm-paginate icon indicating copy to clipboard operation
nestjs-typeorm-paginate copied to clipboard

Asking : Find parameter

Open ColeoptereMoroseDeVan opened this issue 2 years ago • 3 comments

Hi,

Requirements

  • "nestjs-typeorm-paginate": "^4.0.1"
  • "typeorm": "^0.3.6"

Wanted

I want to filter my response data by a search param, like the example of the doc about cat and their lives. (I want to receive only cats that have 9 lives)

So, I tryed the example :

return paginate<CatEntity>(this.repository, options, {
      lives: 9,
    });

However, I don't get the expected value, I received all cats, no matter how much lives they have.

Researched

So I read the code and paginateRepository function add my value correctly, however the filters is not used.

After I checked the repository service I figured out that there is now two options handle by typeorm repository : find and findBy. Find accept { take, skip } FindBy accept { ...entityParams }

So my params can't be filter.

Question

Did I did something wrong, or is this a bug ? Should I use only queryBuilder to add my filters property ?


Thank's for your time and for this amazing module 👍

ColeoptereMoroseDeVan avatar May 13 '22 13:05 ColeoptereMoroseDeVan

Hi,

Requirements

  • "nestjs-typeorm-paginate": "^4.0.1"
  • "typeorm": "^0.3.6"

Wanted

I want to filter my response data by a search param, like the example of the doc about cat and their lives. (I want to receive only cats that have 9 lives)

So, I tryed the example :

return paginate<CatEntity>(this.repository, options, {
      lives: 9,
    });

However, I don't get the expected value, I received all cats, no matter how much lives they have.

Researched

So I read the code and paginateRepository function add my value correctly, however the filters is not used.

After I checked the repository service I figured out that there is now two options handle by typeorm repository : find and findBy. Find accept { take, skip } FindBy accept { ...entityParams }

So my params can't be filter.

Question

Did I did something wrong, or is this a bug ? Should I use only queryBuilder to add my filters property ?

Thank's for your time and for this amazing module 👍

Is there any update on this issue!!?

KhairoHumsi avatar May 31 '22 08:05 KhairoHumsi

{where: {live: 9}}

theothersideofgod avatar Aug 28 '22 08:08 theothersideofgod

{ where: {email: Like(%${variable}%) } } not working with Like?

SuperService avatar Jan 17 '23 19:01 SuperService