From 5d8b1d67cb70e1787e12cba1b6cd41d7a4d6a77a Mon Sep 17 00:00:00 2001 From: "jiho.park" Date: Wed, 11 Oct 2023 17:08:28 +0900 Subject: [PATCH 1/2] chore: release v0.8.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eeeafc2..d33cff0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nestjs-library/crud", - "version": "0.8.3", + "version": "0.8.4", "description": "Automatically generate CRUD Rest API based on NestJS and TypeOrm", "homepage": "https://github.com/woowabros/nestjs-library-crud", "repository": { From c3a58416242cb571b936b7d432d90cbab869f661 Mon Sep 17 00:00:00 2001 From: "jiho.park" Date: Thu, 26 Oct 2023 16:10:28 +0900 Subject: [PATCH 2/2] fix: search next cursor bug --- src/lib/interceptor/search-request.interceptor.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/interceptor/search-request.interceptor.ts b/src/lib/interceptor/search-request.interceptor.ts index f90c73c..8bddca3 100644 --- a/src/lib/interceptor/search-request.interceptor.ts +++ b/src/lib/interceptor/search-request.interceptor.ts @@ -276,8 +276,11 @@ export function SearchRequestInterceptor(crudOptions: CrudOptions, factoryOption }), {}, ); + + let mergedKeySet: Set = new Set(); for (const queryFilter of where) { for (const [key, operation] of Object.entries(cursorCondition)) { + mergedKeySet.add(key); _.merge( queryFilter, key in queryFilter @@ -286,7 +289,13 @@ export function SearchRequestInterceptor(crudOptions: CrudOptions, factoryOption ); } } - where.push(cursorCondition); + for (const [key, operation] of Object.entries(cursorCondition)) { + if (mergedKeySet.has(key)) { + continue; + } + where.push({ [key]: operation }); + } + return where; } }