REST Service for POPCORN - ILIAS
alex
2025-06-06 21e9157e4ff93806321d55691af60c9e414e5e22
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,6 +78,7 @@
   const pool = await poolP
   try {
   let userSearchQuery = getUserSearchQuery(offset, limit, search)
   // console.log(userSearchQuery)
   const [results, fields] = await pool.query(userSearchQuery)
@@ -84,6 +88,14 @@
      offset, limit,
      data: results,
   }
   } catch (ex) {
      return {
         total: 0,
         offset: 0,
         limit: 0,
         data: [],
      }
   }
}
async function getUserCount (offset, limit, search) {