From 168cc038a3af348c1311cee026c8fd67e36b1330 Mon Sep 17 00:00:00 2001 From: goga-m Date: Tue, 3 Oct 2017 20:58:18 +0300 Subject: [PATCH] Provide all customer info in customers.get --- lib/customers.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/customers.js b/lib/customers.js index dd5191f6..eb1f7594 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -17,12 +17,13 @@ function add (customer) { } function get (phone) { - const sql = 'select id, phone from customers where phone=$1' + const sql = 'select * from customers where phone=$1' return db.oneOrNone(sql, [phone]) .then(customer => { if (!customer) return return getDailyVolume(customer.id).then(dailyVolume => { - return _.set('dailyVolume', dailyVolume, customer) + const formatted = camelize(customer) + return _.set('dailyVolume', dailyVolume, formatted) }) }) }