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 =>