REST Service for POPCORN - ILIAS
alex
2025-06-18 2d56dc168ebe5cadbbef53b3b8853d87bc2cfbba
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: [],
      }
   }
}