feat: async autocomplete on individual discounts

This commit is contained in:
Rafael Taranto 2025-06-23 10:15:42 +01:00
parent d0aaf6c170
commit f1e5edd4ac
5 changed files with 146 additions and 103 deletions

View file

@ -488,7 +488,10 @@ function getSlimCustomerByIdBatch(ids) {
const sql = `SELECT id, phone, id_card_data
FROM customers
WHERE id = ANY($1::uuid[])`
return db.any(sql, [ids]).then(customers => _.map(camelize, customers))
return db.any(sql, [ids]).then(customers => {
const customersById = _.keyBy('id', _.map(camelize, customers))
return ids.map(id => customersById[id] || null)
})
}
function getCustomersList() {