Merge pull request #1709 from RafaelTaranto/fix/customer-list

LAM-1140 fix: customer list ordering with limit
This commit is contained in:
Rafael Taranto 2024-08-16 12:25:53 +01:00 committed by GitHub
commit f0e5dc0c84

View file

@ -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 ($6 IS NULL OR id_card_data::json->>'address' = $6)
AND ($7 IS NULL OR id_card_data::json->>'documentNumber' = $7) AND ($7 IS NULL OR id_card_data::json->>'documentNumber' = $7)
AND ($8 IS NULL OR email = $8) AND ($8 IS NULL OR email = $8)
ORDER BY last_active DESC
limit $3` limit $3`
return db.any(sql, [ passableErrorCodes, anonymous.uuid, NUM_RESULTS, phone, name, address, id, email ]) return db.any(sql, [ passableErrorCodes, anonymous.uuid, NUM_RESULTS, phone, name, address, id, email ])
.then(customers => Promise.all(_.map(customer => .then(customers => Promise.all(_.map(customer =>