Provide all customer info in customers.get
This commit is contained in:
parent
f237214219
commit
168cc038a3
1 changed files with 3 additions and 2 deletions
|
|
@ -17,12 +17,13 @@ function add (customer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get (phone) {
|
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])
|
return db.oneOrNone(sql, [phone])
|
||||||
.then(customer => {
|
.then(customer => {
|
||||||
if (!customer) return
|
if (!customer) return
|
||||||
return getDailyVolume(customer.id).then(dailyVolume => {
|
return getDailyVolume(customer.id).then(dailyVolume => {
|
||||||
return _.set('dailyVolume', dailyVolume, customer)
|
const formatted = camelize(customer)
|
||||||
|
return _.set('dailyVolume', dailyVolume, formatted)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue