From c24428b52feeb4b9cfbafac2541e40e9a891b428 Mon Sep 17 00:00:00 2001
From: alex <alex@alexloehr.net>
Date: Sun, 08 Jun 2025 16:34:04 +0000
Subject: [PATCH] fixing current count
---
lib/db.js | 30 +++++++++++++++++++++---------
1 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/lib/db.js b/lib/db.js
index 5ae1746..0d319c9 100644
--- a/lib/db.js
+++ b/lib/db.js
@@ -56,7 +56,10 @@
}
else {
const ids = searchLib.search(search)
- // if (!ids.length) return getUserSearchQuery(offset, limit) // nothing found
+ if (!ids.length) {
+ throw "nothing found"
+ return getUserSearchQuery(offset, limit)
+ } // nothing found
return `SELECT ${sel}
FROM ${database}.usr_data AS ud
WHERE login REGEXP '^[0-9]+$'
@@ -75,14 +78,23 @@
const pool = await poolP
- let userSearchQuery = getUserSearchQuery(offset, limit, search)
- // console.log(userSearchQuery)
- const [results, fields] = await pool.query(userSearchQuery)
- const count = await getUserCount(offset, limit, search)
- return {
- total: count,
- offset, limit,
- data: results,
+ try {
+ let userSearchQuery = getUserSearchQuery(offset, limit, search)
+ // console.log(userSearchQuery)
+ const [results, fields] = await pool.query(userSearchQuery)
+ const count = await getUserCount(offset, limit, search)
+ return {
+ total: count,
+ offset, limit,
+ data: results,
+ }
+ } catch (ex) {
+ return {
+ total: 0,
+ offset: 0,
+ limit: 0,
+ data: [],
+ }
}
}
--
Gitblit v1.8.0