From b93a4c20886c47e80ceeeeca0ba352b9f317cbb9 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Wed, 14 Aug 2024 16:33:34 +0100 Subject: [PATCH] fix: customer list ordering with limit --- lib/customers.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/customers.js b/lib/customers.js index 4279854b..d7975972 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -538,6 +538,7 @@ function getCustomersList (phone = null, name = null, address = null, id = null, AND ($6 IS NULL OR id_card_data::json->>'address' = $6) AND ($7 IS NULL OR id_card_data::json->>'documentNumber' = $7) AND ($8 IS NULL OR email = $8) + ORDER BY last_active DESC limit $3` return db.any(sql, [ passableErrorCodes, anonymous.uuid, NUM_RESULTS, phone, name, address, id, email ]) .then(customers => Promise.all(_.map(customer =>