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

[bug] paginate not filter 🐞

Open gohunter opened this issue 3 years ago • 1 comments

Hello! I am using the example with TypeOrm and MySQL: @Injectable() export class CatService { builder( @InjectRepository(CatEntity) private readonly repository: Repository<CatEntity>, ) {}

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

and when reviewing the query log, the generated SQL does not apply WHERE in the query and as a result it lists all the paginated records but without applying the WHERE filter.

Meanwhile I am using createQueryBuilder.

Thanks.

gohunter avatar Oct 31 '22 17:10 gohunter

Try

{where: {lives: 9}}

TahaDgn avatar Nov 07 '22 08:11 TahaDgn