From cacf5cc59c9224e40aedadd987a397131beffa50 Mon Sep 17 00:00:00 2001 From: sopy Date: Fri, 15 Sep 2023 16:27:20 +0300 Subject: [PATCH 1/2] Modify query parameter handling in ExploreDB Fixed condition that pushes userid and topic into params in ExploreDB.ts. The changes ensure that the userid only gets added when it is not a countQuery and there is a valid userid. Additionally, the logic for handling an array of topics has been updated to spread the array values instead of pushing the entire array. --- src/util/Database/ExploreDB.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/util/Database/ExploreDB.ts b/src/util/Database/ExploreDB.ts index 75a2047..b0d62fc 100644 --- a/src/util/Database/ExploreDB.ts +++ b/src/util/Database/ExploreDB.ts @@ -62,12 +62,17 @@ class ExploreDB extends Database { ): unknown[] { const params = []; - if (!isCountQuery) { + if (!isCountQuery && userid) { params.push(userid); } params.push(`%${search}%`, `%${search}%`); - params.push(Array.isArray(topic) ? topic.map((t) => t.toString()) : topic); + + if (Array.isArray(topic)) { + params.push(...topic); + } else { + params.push(topic); + } if (!isCountQuery) { params.push((page - 1) * limit, limit); From 2d74ff69b2eaac2906c6fcdf556a49383ad0fc69 Mon Sep 17 00:00:00 2001 From: sopy Date: Fri, 15 Sep 2023 16:27:55 +0300 Subject: [PATCH 2/2] Version bump --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index dd3e909..9e1296b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "navigo-learn-api", - "version": "2.0.3", + "version": "2.0.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "navigo-learn-api", - "version": "2.0.3", + "version": "2.0.4", "license": "BSD 3-Clause", "dependencies": { "axios": "^1.4.0", diff --git a/package.json b/package.json index 137fb14..455d4b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "navigo-learn-api", - "version": "2.0.3", + "version": "2.0.4", "description": "Navigo Learn API", "repository": "https://github.com/NavigoLearn/API.git", "author": "Navigo",